When Java was developed in 1995, there are other languages - C / C++. There were other languages too - COBOL, PASCAL, FORTRAN and they had specific purposes. C language became popular in 1972 to develop programs and solve complex problems on all the platforms (operating systems). C was the structural language and the program was written on each platform to compile and run specifically on that platform. For each platform, the code was re-written and executed to run on the platform.
In 1979, C++ was developed as enhanced version of C language. C++ was too structural languages with object oriented fundamentals and features. Because of the object oriented, it was possible to reuse of some of the components of the program. Still, the code was re-written / compiled for each platform. So, for all the structured languages, the following path was used to compile the program files and run on the specific platform -
To change anything in the program, whole code was needed to compile and execute again and also for each platform separately.
In 1995, Java was developed to enhance C++ object oriented features, but Java is a very different language than C++. Java is totally object oriented language. Java language is data driven, and data is in the form of objects (things) and procedures were in objects specifically used to manipulate data itself.
In Java, everything is categorized as a class and each class can have its own data (properties / features / fields whatever you name) and methods (used to manipulate data inside or outside the class, interact with other classes, etc.). Each class has a separate file .java file. And objects are the instances of the classes.
Each .java file is compiled and converted into a byte-code file .class file. This byte-code file is universal file for every platform. Each platform has their own JVM (Java Virtual Machine) or Java platform, which interprets the .class file for that specific platform. When there is a need in change in any particular class, you compile only that class and load it again. You don't need to compile and execute whole program again.
As shown in above picture, Java file is only once compiled and converted into byte code. JVM (Java Virtual Machine) /Java platform is developed for all available platforms mostly. JVM interprets the same byte code for the specific platform and runs on the machine accordingly.
So, byte-code is an intermediate code file which is not machine specific and can be run on any platform with the help of Java Virtual Machine (JVM).
No comments:
Post a Comment