☰ Topics

Introduction to Java

Java is related to C++, which is a direct descendent of C. From C, Java derives its syntax. Since C language is not platform independent, we can't develop applications with the help of it. For application development, we need a language which is platform independent i.e. run on different machines having differnt architectures. In java, both hardware and software coding are independent of each other.

Java was first developed by Sun Microsystem in 1991 and it was named as Oak. In 1995, its first version was released and it was named as Java. It was in the form of gadgets i.e. used in different machines like washing machine etc.

For working on java, we have to install jdk(Java Development Kit) version 1.x i.e. 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8. It is a freeware. When jdk is installed, three components are installed i.e. JVM(Java Virtual Machine), JRE(Java Runtime Environment), and API(Application Programming Interface)

JVM is used to compile, execute and run the program.

JRE is used to run program in different programming environments i.e. on different platforms.

API is the pre-defined library used by the programmer.


 


The end user interact with the program, the program interact with the JVM, JRE and API and these interact with operating system and then finally operating system interact with hardware.

Java is both compiler and interpreter based language. When Java code is compiled, source code is converted into byte code(highly optimized set of instructions) and after compiling, byte code is converted to machine code which is done by interpreter.


 


The java source code has the file extension .java and it is compiled to form byte code with file extension .class and this byte is machine indepedent and it is changed to machine code(which is machine dependent) by Just-In-Time(JIT) compiler and it is interpreted to generate output. Therefore, because of this executable middle layer code i.e. byte code, java is a platform independent language.