- Java is an high level programming language developed by Sun Microsystems in 1991.
- Initially there was a team called Green Team, under the head of James Gosling they developed the language and named it as OAK and later on, changed to JAVA in 1995.
- Java is a Platform Independent Language.
- Java is simple and object oriented.
Java is Object Oriented :
- Java uses class and objects.
- It supports inheritance, polymorphism, abstraction and encapsulation.
Inheritance in Java :
Inheritance is a process in which one class acquires the properties of other. In java, the class which inherits other class is called as sub class and the class which is inherited is called as super class. A sub class can inherit a super class by using extend keyword.
Polymorphism ensures that an object can take more than one form. In Java, there are two types of polymorphism.
- Compile time polymorphism
- Run time polymorphism
Abstraction is a process of hiding the inner details and showing only the external functionalities. In Java abstraction is achieved by using abstract class and interfaces.
Encapsulation refers to the wrapping up of datas and functionalities together into a single unit.
The JDK :
The JDK (Java Development Kit) is used for the application development process and it contains the compiler, the JRE, the class libraries, and other tools necessary for the development process.
The Java compiler compiles the source code into byte code which is then interpreted and executed by the JVM (Java Virtual Machine).
Java is Platform Independent and C/C++ is not. A platform refers to a combination of OS and CPU Architecture. When a C/C++ source code is compiled in one platform (Eg. Windows) binary code is generated specific to that platform and can be executed only in that platform. But in Java, when a source code is compiled the byte code is generated instead of binary code as seen in the case of C/C++ languages. These byte code is interpreted by the JVM. The JVM is specific to platform. The JVM interprets the byte code specific to the platform on which it is installed.
Garbage Collector :
One of the special features of Java is Automatic Garbage Collection. User need not to worry about the memory management. In turn, Java takes care of the memory management. The JVM automatically allocates the memory space when a new object is created and the Java Garbage Collector cleans up the memory space when the object is not no longer needed.
- Java uses C++ type of syntax.
- Java does not use explicit pointer and hence provides security.
- Java is multi threaded and hence it can perform many task at a same time.
- A Java byte code can run on any JVM installed machine.