in .exe file it contains machine understandable code. but in .class file it contain only byte code which is not understadable by the microprocessor it will understud by the jvm only . we con't execute .class file without jvm . but we can execute .exe file without c-compiler .
Java source files have the .java extension, compiled Java class files have the .class extension.
Java compiles to Java byte code; the native language of the Java virtual machine (JVM). The JVM is essentially just an interpreter for Java byte code. Each supported platform has its own JVM implementation so the same Java byte code can be executed upon any platform without further compilation, unlike C++ where source code must be compiled separately for each supported platform. However, interpretation results in slower execution speed and higher resource consumption than with C++ which compiles to native machine code.
Java is both compiled and interpreted language.First Java source code has to be translated into Byte code, which is done with the help of a compiler.But these byte codes are not machine instructions. Therefore ,in second stage this byte code has to be translated into machine code.This task is performed by an Interpreter.Hence, Java use both compiler and interpreter.
Java is a platform independent language.After compiling the ".java" file ,that will be converting into the ".class" file,which is a byte code having the capability run on any OS.Basing on the concept byte code java achieving the platform independent,it leads to "Write once run anywhere".
in .exe file it contains machine understandable code. but in .class file it contain only byte code which is not understadable by the microprocessor it will understud by the jvm only . we con't execute .class file without jvm . but we can execute .exe file without c-compiler .
Java source files have the .java extension, compiled Java class files have the .class extension.
If you want to compile a java program the name of that source code must end with extension .java
Java compiles to Java byte code; the native language of the Java virtual machine (JVM). The JVM is essentially just an interpreter for Java byte code. Each supported platform has its own JVM implementation so the same Java byte code can be executed upon any platform without further compilation, unlike C++ where source code must be compiled separately for each supported platform. However, interpretation results in slower execution speed and higher resource consumption than with C++ which compiles to native machine code.
What i know is java we will use compiler when it want to get class file(file with .class extension) from java file(file with .java extension).
when we compile a file in java, it creates a byte code which later on gets interpreted to machine understandable code. byte code is not machine language. where system understands only machine language. hence the interpretation of byte code is required.
You write the source code, in a text editor, or better in a special IDE. The source code should have the extension ".java". You can have several classes in the same file. Then you compile the class to bytecode; this creates a file with extension ".class".
Java is both compiled and interpreted language.First Java source code has to be translated into Byte code, which is done with the help of a compiler.But these byte codes are not machine instructions. Therefore ,in second stage this byte code has to be translated into machine code.This task is performed by an Interpreter.Hence, Java use both compiler and interpreter.
Java byte code is the code that is output by the Java compiler. Byte code is not machine code, it must be interpreted to create the machine code. This is handled by the Java virtual machine. Pretty much every platform produced today has a Java virtual machine implementation, so the same byte code can be executed upon any machine. Byte code can be regarded as being the native language of the virtual machine, as opposed to machine code which is the native language of the physical machine.
Java is a platform independent language.After compiling the ".java" file ,that will be converting into the ".class" file,which is a byte code having the capability run on any OS.Basing on the concept byte code java achieving the platform independent,it leads to "Write once run anywhere".
.jar files contain byte-code compiled to run on the Java Virtual Machine.
The source code is just the set of statements written in (any included) java language by a programer (in this case our source code is a text file with .java extension). And in other hand a bytecode is the resulting code of compile a .java file, It is not machine code, but it can be interpreted and executed by the jvm.