Java Introduction

Java Introduction


Programming paradigm means the way to write code

High-level programming language depends on programming paradigm.

 

Java History

1984 : Bjarne strostrap developed a language C++ [ C with class].

  • 1990 : Sun Microsystem Created a team
  • Team head : James Gosling
  • Team members : Patrick, Mike, Richer
  • Aim : To control consumer electronics devices like TV, Toaster, VCR etc.

 

Java Introduction

Java is a general-purpose language, truly object-oriented, high-level programming language, and a Platform by itself.

Java has predefined classes called JAVA API (Application programming interface) using them we can create a new program so JAVA is a computer programming language.

Since JAVA has its own runtime environment called JRE(java runtime environment), s JAVA is a platform.

Java is a machine, and platform independent language.

 

 

Features of Java (Buzzwords of Java)

  1. Simple- Java is a simple programming language because-
  • Syntax based on c/c++
  • No operator overloading
  • Automatic memory management 

  2.   Architecture Neutral -The size of primitive datatype is fixed in Java.

   NOTE- In c/c++ primitive data type depoands on compiler or operating system.

  3.   Platform Indepandent

        We  can carry bytecode and execute on any platform.

   4. Compiled, and Interpreted – Compiled, and interpreted both types of language, firstly Java compiler convert source code into byte code then JAVA interpreter convert bytecode into executable code.

For example-

  • c/c++ is compiled language
  • Python, VB script, JAVA script are interpreted language.
  • JAVA is compiled and interpreted both.

5.  Object Oriented

Java is a truly object oriented, but not 100%  because primitive datatype of java has no class.

  • Abstraction
  • Encapsulation
  • Inheritance 
  • Polymorphism

6.  Secured – java is secured language because

  • Two times checking of java program 
  • Java program runs inside the virtual land box of JVM.

7. Robust (Strong)

  • Strict checking of datatypes 
  • NO memory leak
  • Java supports execption handling

8. High performance

 9. Multithreaded

10. Dynamic 

 

 

Java API(Application Programming Interface)

Java API is the collection of predefined classes, and interface using them we can create new program Java has many built-in packages.

A package contains classes.

 

 

 Devlopment Tools

  • Java C - Java Compiler
  • Java Interpreter
  • Java db - Java Debugger
  • Java Doc - Java Documentation
  • Java h - Java header files
  • Appltviewer - to run the applet
  • Java ap - java programming

JRE(Java Runtime environment)

It is the physical implementation of JVM. It contains JVM and other files otherwise files used by JVM at the time of program execution.

 

JVM( Java virtual machine)

It converts bytecode into executable code

 

JVM Contains-

  • Class loader
  • Bytecode Verifire
  • Interpreter
  • Security Manager
  • Garbage Collector

 

JVM Operations -

The JVM performs following operationJava Try Catch

  • Loads code
  • Verifies code
  • Executes code
  • Provides runtime environment

JVM provides definitions for the:

  • Memory area
  • Class file format
  • Register set
  • Garbage-collected heap
  • Fetal error Reporting etc.

1) Classloader

Classloader is a subsystem of JVM which is used to load class files. Whenever we run the java program, it is loaded first by the classloader. There are three built-in classloaders in Java.

  1. Bootstrap ClassLoader: This is the first classloader which is the super class of Extension classloader. It loads the rt.jar file which contains all class files of Java Standard Edition like java.lang package classes, java.net package classes, java.util package classes, java.io package classes, java.sql package classes etc.
  2. Extension ClassLoader: This is the child classloader of Bootstrap and parent classloader of System classloader. It loades the jar files located inside $JAVA_HOME/jre/lib/ext directory.
  3. System/Application ClassLoader: This is the child classloader of Extension classloader. It loads the classfiles from classpath. By default, classpath is set to current directory. You can change the classpath using "-cp" or "-classpath" switch. It is also known as Application classloader.

2) Method Area:- Method Area stores per-class structures such as the runtime constant pool, field and method data, the code for methods.

3) Heap:- It is the runtime data area in which objects are allocated.

4) Stack:- Java Stack stores frames. It holds local variables and partial results, and plays a part in method invocation and return.