Introduction to Java



 


Java programming language was designed to develop internet applications by providing platform independence.
Java is simple, secure, Multi-threaded, platform independent and an object oriented language, it was developed by James gosling in sun Microsystems in the 1990s.
The first version was released on January 23, 1996
It is similar to c and c++, but it omits many of the features that make C and C++ complex, confusing and unsafe
You will not find concepts of pointers, structure, union, operator overloading or multiple inheritances.




Here is what happens when you compile your program 

Source

Here you write your code and the file gets saved under .java extension.

Compiler

The compiler will compile the file saved under .java extension, which is your code. For this to run, you need to call javac which stands for java compiler.Compiler generated file is saved as a class file which saves with the .class extension.

Virtual machine

This class file then goes to the virtual machine which translates this file, also known as byte code into something which the system understands

 



Platform independent

Compiler converts Java source code (program.java as shown in the figure) into bytecode and stores these files in a file with the extension .class

JVM executes these bytecodes

Notice that there are different versions of JVM. The JVM on a windows machine is different to a JVM on linux machine making Java software platform dependent.

The Java virtual machine converts this bytecode to machine language code which the system can understand.

Does that mean Java is not entirely platform independent?
The Java programs are platform independent but java software is not. JVM is a java software and the one that runs on windows is different when you compare it to the one that runs on Linux or Solaris.
JVM is available for every operating system separately.

Let us learn types of java softwares next

Types of Java softwares

  1. JRE
  2. JDK

    JDK has both a compiler and JVM. when you install the Java development kit it installs JRE which has the JVM and also the compiler. If you just want to execute the applications which have already been developed, then you can install only the JRE not the SDK.



     

Tech prex

1 comment: