Tuesday, May 1, 2012

Introduction to JAVA

 Lets Start with Why JAVA??
Features of java:

-Simple 
Syntax of java is similar to C/C++ so its easy to learn and provides more library functions compared to C/C++. Java is simple to write bug free code as compared to other programming languages.


-Object Oriented

The most important concept of JAVA is objects. JAVA is object oriented programming language. In procedural languages importance is given to logic rather than Data but in object oriented programming languages Data are centered.

In java ,  logic (or behavior or methods commonly known as functions in languages like C) and properties (or Data ) are bind together in one entity called class. Classes are just like blue prints for the actual object.This property of binding methods and data together is known as encapsulation.

Encapsulation is the key because of which the JAVA objects are so similar to real world objects. As a real world object has properties and behavior , java objects have Data and methods.


-Redistributed
Java programs can run distributed on a network. For example Server-Client applications or Multiple Systems connected over a network working together to accomplish a Task.
 
-Robust
Java program does not effect OS and there is very less likely chances for System crash if a program or application fails or crashes.In other words unlike C there you will not face System crash problem because of bad program.

-Secure
Java compiler catches much more compile time errors as compared to C/C++ , also by removing pointers from JAVA it has increased security level.

-System Independence
Java is platform Independent programing language.Actually Java is JVM (Java Virtual machine) or JRE (Java run time environment) dependent. Java is both compiled and Interpreted. Java compiler compiles a .java file and generate a .class bytecode file which is interpreted by JVM and executed in the System environment. Thus the same .class file can be executed in different platforms in which the JRE is available.

-Portability
As said java is platform independent thus its portable as same compiled file can be  executed in different platforms in which the JRE is available.

-Interpreted
Java is both compiled and interpreted.
Note:
for example you have a MyFile.java
You compile it as:
$javac MyFile.java
Then you execute it by invoking JRE as:
$java MyFile


-High Performance
 Java provides high performance because of JIT (Just in Time) compiler which is high speed compiler.Just in time compilation also known as dynamic translation improves and increases performance and speed of computer programs.


-Multi Threaded
 Java Supports Multi threading programming.

 -Scalability
 Java is modular so supports Scalability as code can be modified and added in any project without having side effects on other modules.

-Dynamic
Because of JIT Java supports Dynamic translation and Dynamic memory allocation.

Its Just one line Introduction to each feature but it will be much clear as we will move further.