Search This Blog

Wednesday, 17 May 2017

Introduction to Java

Introduction to Java

Java is a general-purpose computer programming language that is concurrent, class-based and object-oriented. Java is intended to let application developers "write once, run anywhere" (WORA) meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. 
Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture. As of 2016, Java is one of the most popular programming languages in use, particularly for client-server web applications. 
Java was originally developed by James Gosling at Sun Microsystems (later acquired by Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.

Principles
There were five primary goals in the creation of the Java language  
  1. It must be "simple, object-oriented, and familiar".
  2. It must be "robust and secure".
  3. It must be "architecture-neutral and portable".
  4. It must execute with "high performance".
  5. It must be "interpreted, threaded, and dynamic".

Java Virtual Machine (JVM)
Oracle provides a set of programming tools such as javac, java and others in a bundle called Java SDK(JDK) for different platforms (Windows, Linux, etc)
Oracle also provides a runtime bundle with just the JVM (Java Virtual machine) when programming tools are not needed.

JVM is a program that runs on a given platform and takes the bytecode as input and interprets them just as if it were a physical processor executing machine code. javac compiler transforms the Java language source code to bytecode that runs in the JVM.

With most programming languages you either compile or interpret a program so that you can run it on your computer. The Java programming language is unusual in that a program is both compiled and interpreted. With the compiler, first you translate a program into an intermediate language called Java bytecodes – the platform independent codes interpreted by the interpreter on the Java platform. The interpreter parses and runs each Java bytecode instruction on the computer. Compilation happens just once; interpretation occurs each time the program is executed.




You can think of the Java bytecodes as the machine code instructions for the Java Virtual Machine(Java VM). Every JVM interpreter, whether it’s a development tool or a web browser that can run applets, is an implementation of the Java VM.
Java byte codes help make “write once, run anywhere” possible. You can compile your program into bytecodes on any platform that has a Java compiler. The bytecodes can then be put on any implementation of the Java VM. That means that as long as a computer has a Java VM, the same program written in the Java programming language can run on Windows, a Solaris workstation or an iMac.

No comments:

Post a Comment