Thursday, April 12, 2007

What is Java class file's magic number?

A Magic Number of a class file is a unique identifier for tools to quickly differentiate class files from non class files.The first four bytes of each Java class file has the magic value as 0xCAFEBABE.And the answer to why this number,I do not actually know but there may be very few sensible and acceptable options possible constructed from letters A-F which can surely not be 'CAFEFACE' or 'FADECAFE'....

6 comments :

Anonymous said...

This value is a inside joke by the creators of java. It alludes to a statement like "Caffeine baby" refers to caffeine and coffee, hence the name of the language "Java" and the coffee reference.

Deepun on November 11, 2009 at 8:36 AM said...

Correct...an anecdote quite popular in Java world..

Anonymous said...

Terrific work! This is the type of information that should be shared around the web. Shame on the search engines for not positioning this post higher!

Vijay Tidake on January 16, 2011 at 10:09 AM said...

Realy good..I don't know this

Anonymous said...

The wiki entry about Java class files contains the historical episode about 0xCAFEBABE: http://en.wikipedia.org/wiki/Java_class_file

Anonymous said...

really good ans...

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2016. Reads: best tracker