How the byte code is generated at the time of compilation. What's the Use of interpreter?
3 Answers
.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

- 1
- 1

- 334,321
- 69
- 703
- 674
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.

- 5,691
- 2
- 27
- 31
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.

- 22,355
- 2
- 39
- 64

- 72
- 1