Thursday, December 11, 2014

INTRODUCTION TO JAVA


What is JAVA?1. Java is a simple and yet powerful object oriented programming language.
2. Java originated at Sun Microsystems, Inc. in 1991.
3. It was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank,and Mike Sheridan at Sun Microsystems, Inc.
4. It was developed to provide a platform-independent programming language.
5. Java is general purpose programming language we can develop any kind of application.

What is NOT java?
Java is not an HTML and JavaScript.

Java versions and History of java :

1. JDK Alpha and Beta (1995).
2. JDK 1.0 (Jan 23, 1996).
3. JDK 1.1 (Feb 19, 1997).
4. J2SE 1.2 (Dec 8, 1998).
5. J2SE 1.3 (May 8, 2000).
6. J2SE 1.4 ( Feb 6, 2002).
7. J2SE 5.0 ( Sep 30,2004).
8. Java SE 6 (Dec 11, 2006).
9. Java SE 7 (July 28, 2011).
10. Java SE8 (Mar 18, 2014).

The flavors of java are:
Java Standra Edition : Core Language;  compiler,tools and runtimes; basic applications & applets.
Java Enterprise Edition: Enterprise level applications;CORBA;RMI;EJB;Web development( servlets,JSP);Windows messaging;XML.
Java Micro Edition:For devices constraind by memory and/or power( phones,fridz,oven,toaster etc..)

Advantages or Benfits or Features or Key Factors or Capabilities or Design goals of java : 
Since Java is an object oriented programming language it has following features:


1. Simple: Java is a simple language and easy to understand. It contains features of C & C++. It is free from concepts like pointers and does not use headerfiles and preprocessors. Does not support Multiple Inheritance.

2. ObjectOriented: Java supports the basic notions of OOMethodology(Object-Oriented Methodology) in which data is treated as Objects and java code is in modular object oriented units called Classes.
· Encapsulation
· Data Abstarction
· Inheritance
· Polymorphism
· Persistence
These features improve the Reusability of code and Dynamic & Extensability of code.

3. Portable (Platform-Independent): JAVA is called as a platform independent programming language. If you have written some code in JAVA ,then after compilation Byte code will be creted then you can run that code on any platform( Different OS & Processors) .Java works on “Write Once Run Anywhere”.

4. Distributed: Byte code transfer from one machine to another machine and then excutes. Ja va specially designed for internet users which uses the remote computer to execute their programs on local machine after transferring the program from remote computers or either from internet through HTTP or FTP protocols. Java work on variety of plateforms.It provides support for
· Networking :via socket Programming.
· Internet :The widely used protocol such as HTTP and FTP are developed in Java
· Remote Objects : Internet programmers can call functions on above protocols and can get access the files from any remote machine on the internet rather than writing codes on their local system.

5. Interpreted: Javais both compiled and interpreted. The Java Compiler generates bytecode for a JVM(JavaVirtualMachine).A Java Interpreter is needed to execute the bytecode.

6.Robust: It provides Exception Handling, Errorhandling, Memory protection and management.It also provides Extensive compile-time checking. It first checks the reliability of the code before execution. Java puts a lot of emphasis on early checking for possible errors, as java compilers are able to detect many problems prior to execution.


7.Secure: The Java language has built-in capabilities to ensure that violations of security do not occur. Java uses the public key encryption system to allow the java applications to transmit over the internet in the secure encrypted form.
· No memory pointers
· Array index limit checking.
After compilation Java source file is converted into .class file which has binary form which is not a native form of Java.This file is not human readable form,so it becomes more secure.


8. Architectural Neutral: Java sorce code compiled to bytecode which is independent and neutral but can be easily translated into a specificb machine by JVM for that machine. Bytecode can run on anyplatform(with the help of JVM). “Write once run anywhere”.

9. Reusable: With the help of Inheritance we reuse the code i.e all predefined and built in functions of java and classes.

10. Dynamic: Java is both dynamic and extensible. Java classes are stored in separate files and are loded into the java interpreter only when needed. A program dynamically extend itself by loding the classes to expand its functionality.

11. HighPerformance: Java language supports manyhigh-performance features such as multithreading, just-in-timecompiling , and nativecodeusage. Java 1.2 new release of JIT (Just-in-time ) compiler converts the bytecode into native machine instructions on the fly.

12. Multithreading: concept allows the java programming language to do more than one task in a program.Thus Java provides high performance.

13. Automatic Memory Management: Garbage is an object ,that is in a dead state. Automatic memory management, also known as automatic garbage collection.This concept of garbage collection is a approach of allowing the language implementation to keep track of used and unused memory.Here now use is free from the burden of freeing the memory.Garbage collection occurs when one of the following occurs:

· passing null reference
· assign reference of one to another.
· using anonymous object



Example-











In this figure there are two heaps, the first heap contains a=5 & b=7 & the second heap contains a=3 & b=4.In heap2 a reference variable is assigned to that is S1, but in heap1 no reference variable is assigned to those objects. So this object becomes garbage collected.

     Because of Java's robustness, ease of use, cross-platform capabilities and security features, it has become a language of choice for providing worldwide Internet solutions.





















































No comments: