-3

How the byte code is generated at the time of compilation. What's the Use of interpreter?

Srivathsan
  • 519
  • 4
  • 18

3 Answers3

7

.class file in Java contains mostly Java byte code + some meta information. You can use javap tool to examine the contents of .class file.

See also

Community
  • 1
  • 1
Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
2

A Java class file contains byte code and some other information. Byte code is what your source code is compiled to, just like a C program compiles a C source file to machine code.

The Java compiler takes your English-like syntax source document and translates it into byte code. This byte code is then executed by the Java runtime environment. In this way, Java is both a compiled and interpreted language, which can be bit confusing in the beginning.

Ewald
  • 5,691
  • 2
  • 27
  • 31
0

A .java file when compiled gives you a .class file which is in byte code. All the code you typed (classes, methods and variables) in your .java file will be converted to byte code which is a JVM readable file and is stored with .class extension.

John Fisher
  • 22,355
  • 2
  • 39
  • 64