Introduction to Java

Introduction to Java

  • Java is a popular programming language.
  • It was developed by James Gosling and Patrick Naughton.
  • JAVA was developed by Sun Microsystems Inc in 1991, later acquired by Oracle Corporation. 
  • It is owned by Oracle, and more than 3 billion devices run Java.
  • It is used for:
    • Mobile applications (especially Android apps)
    • Desktop applications
    • Web applications
    • and more


Why Use Java?


  • It helps to create modular programs and reusable code.
  • Java works on multiple platforms such as Windows, Mac, Linux, Raspberry Pi, etc..
  • It is most popular object-oriented programming language in the world
  • It is easy to learn and simple.
  • It is open-source and free.
  • It is secure, fast and powerful.
  • It is very close to C++ and C#.


How to check java install on your machine?

  • To check if you have Java installed on your Windows PC.
    • Click on start > Run and write "cmd" click enter.
    • Write command:"java -version"
  • If Java is installed, you will see something like this (depending on version).
  • If you do not have Java installed on your computer, you can download it for free from oracle.com.


Java Virtual Machine (JVM)


  • Phases are as follows: 
    • Writing phase
    • Compiling phase
    • Executing phase
  • We write the program, then we compile the program and at last, we run the program.
    • 1) Writing of the program is of course done by java programmer like you and me.
    • 2) Compilation of program is done by javac compiler, javac is the primary java compiler included in Java Development Kit (JDK). It takes java program as input and generates Java bytecode as output.
    • 3) In the third phase, JVM executes the bytecode generated by the compiler. This is called program run phase.


Note: Each OS has different JVM, however the output they produce after execution of bytecode is same across all OS.

What is Bytecode?


  • A javac compiler of JDK compiles the java source code into bytecode so that it can be executed by JVM. 
  • The bytecode is saved in a .class file by compiler.


What is JDK?


  • JDK stands for Java Development Kit.
  • It is complete Java Development Kit that includes JRE (Java Runtime Environment), compilers and various tools like JavaDoc, Java debugger etc.
  • In order to create, compile and run Java program you would need JDK installed on your computer.


What is JRE?


  • JRE stands for Java Runtime Environment.
  • JDK includes JRE. 
  • When you have JRE installed on your system, you can run a java program however you won’t be able to compile it. 
  • JRE includes JVM, browser plugins and applets support. 
  • When you only need to run a java program on your computer, you would only need JRE.


What is JIT?


  • JIT stands for Just-In-Time.
  • It is a an essential part of the JRE.
  • It is responsible for performance optimization of java based applications at run time.
  • JIT compilers interact with the JVM at run time and compile suitable bytecode sequences into native machine code.
Note: The JDK contains JRE > JVM > JIT.
  • Hence, once if we install JDK all the other components are automatically installed.


Main Features of JAVA


  • Java is a platform-independent language
    • Java is an Object-Oriented language such as Abstraction, Encapsulation, Inheritance, Polymorphism
  • It is very simple.
    • It does not have complex features like Operator overloading, Multiple inheritance, pointers, and Explicit memory allocation.
  • It is robust Language
    • The main features of java that make it robust are garbage collection, Exception Handling, and memory allocation.
  • It is very Secure due to bytecode.
  • Java is distributed
    • The java programs can be distributed on more than one system that are connected to each other using internet connection.
  • It can most suitable for Multithreading.
    • Multithreading is a Java feature that allows concurrent execution of two or more parts of a program for maximum utilization of CPU.
  • It is the most popular portable language.
  • Java code that is written on one machine can run on another machine. 


More term on java

Thanks a lot for query or your valuable suggestions related to the topic.

Previous Post Next Post

Contact Form