Professional Documents
Culture Documents
Introduction To JAVA
Short note on JAVA:-JAVA is an Object Oriented Programming(OOP) language developed at Sun Micro Systems
by James Gosling and Team. It was initially called Oak. It was initially used to design electronic circuits but later
on applied to develop Web based application.
Features of JAVA :-
i)Object Oriented:-Programs in JAVA are executable through the objects, which interact with each other by
passing messages using different methods and thus make a program more dynamic
ii)Both Compiled and Interpreted:- JAVA uses both compiler and interpreter JAVA complier (Javac) converts
the source code to Byte code, which is platform independent (JVM-Java Virtual Machine) converts the Byte
code to Object Code(machine readable).
iii) Strongly Typed:- All the variables and methods must be defined with all legal data type before actually
using them. Eg a=5, will be wrong, int a=5 will be correct.
iv)Case sensitive:-Java understands uppercase and lowercase characters in different senses. Eg variables a and
A are treated separately; int a=5; String A=”School”;
v)Robust and secure:- JAVA’s inbuilt Exception Handling(error correction) mechanism makes the programs
platform independent . Byte code generated by the java compiler is converted into machine code by the JVM
depending on the operating system the program is run, thus making the program portable and platform
independent.
vi)Write Once Run Anywhere(WORA)- The java programs need to be written just once,which can be run on
different platforms without making changes iin the java program.
Types of java:-
Internet applets:- They are small programs that are embedded in web pages and are run on the viewer’s
machine in a secured manner. Applets are designed to be delivered to internet web browsers and that is why
an applet has a built-in graphical window. But java applets have some security restrictions.
Standalone applications:- It is generally a software application that does not require low level operating
system or hardware access. This includes must off the usual desktop applications such as word processors or
spreadsheets. Standalone java application of java begins executing with a main method.
Ordinary compilation process:- The process of converting a source code into machine code is called
compilation. The converted machine code depends a lot on the platform it is executing upon. That means for
different platforms different machine code is produced. The resultant machine code is called native executable
code.
Java compilation:-
i) Java programs are written in “.java” file(source code) and then compiled by java compiler.
ii) Byte code:- Byte code is the code generated after the java program is compiled.(.class file)
iii) Java virtual machine:- This is virtual machine which reads the byte code and interprets into
machine code depending upon the underlying operating system and hardware combination.
iv) Just in Time (JIT) compiler”- Just in time compiler is part of the Java Virtual Machine(JVM) and it
compiles byte code into executable code in real time, on a piece-by-piece, demand basis.
Difference:-
The properties defining an object are also termed as attributes of object or characteristics of object.
How are objects implemented in software terms:-
An object is implemented in software terms as follows:-
i) Characteristics/attributes are implemented through member variables or data items of the object.
ii) Behaviour is implemented through member functions called methods.
iii) Data and methods are encapsulated into one unit and given a unique name to give it identity.
Object factory:-
An object factory is a producer of objects. It accepts some information about how to create an object, such as
values depicting its state, and then returns an instance of that object. Valid representation and the nature of
the information that are determined by the object factory and are closely tied to the abstraction represented
by the class as object factory.