Friday, 16 January 2015

Java Introduction


Java SE:
Deals with developing stand alone applications and Networking applications and also exploring library.

Java EE:
Deals with developing Enterprise(business) solutions for a network.

Java ME: (Micro edition or Mobile edition)
It deals with developing embedded systems  and wireless applications.

Execution of a Java program:
Java soft people created 200 instructions.Each instruction takes 1 byte(8 bits).By using these instructions each java source code is declared into "bytecode" instructions.This type of file is .class file. So .class file contains byte code.

JVM:- (java virtual Machine)
 It is a program that understands all byte code instructions and converts into Machine code which is understandable to the processor.
Note:
Java programs are system independent because they can be executed on any other System. There fore java is suitable for internet.
Note:-  
1).class file is System independent.
2)JVM is System dependent Why because it is written in C.
History of java:-
In 1990,Sun Microsystems Inc.(US) has conceived a project to develop software for consumer electronic devices that could be controlled by remote.
      In 1991 Bill Joy,James Gosling,Mike sheradin and seveal others met and discuss about this project.Finally they developed new Language in 1993 called Oak.But this name was registered by some other company.Later it was changed to Java.
In 1994,They developed a web browser called "HotJava".It is the first web-browser,having the capabilities of executing applets,which are programs designed to run dynamically on Internet.
In 1995, They announced Java and HotJava at Sunworld conference.After that on 1996 January 23 JDK1.0 version was released.
·         Simula is considered as the first object-oriented programming language.
·         Smalltalk is considered as the first truly object-oriented programming language
·         Object means a real word entity
o   Any entity that has state and behavior is known as an object
        An object has three characteristics:
  • state: represents data (value) of an object.
  • behavior: represents the behavior (functionality) of an object such as deposit, withdraw etc.
  • identity: Object identity is typically implemented via a unique ID. The value of the ID is not visible to the external user. But,it is used internally by the JVM to identify each object uniquely.
Object-Oriented Programming is a methodology or paradigm to design a program using
classes and objects
CLASS
Collection of objects is called class. It is a logical entity.A class is a group of objects that has common properties. It is a template or blueprint from which objects are created.
Ways To create an object in java :
There are four ways of creating objects in java.
1.Using new operator.
   ex: Employee obj = new Employee();
2.Using factory methods.
   ex:- NumberFormat obj = NumberFormat.getNumberInstance();
Here we are creating the NumberFormat object using factory method getNumberInstance().
3.Using newInstance() method.Here,we should follow two steps,as
a)First,store the class name 'Employee' as a string into an object.For this purpose,factory method forName() of the class 'Class' will be useful.
    Class c = Class.forName("Employee");
          here Class is a class in java.lang package.
b)Next,create another object to the class whose name is in the object c,for this purpose,we need newInstance() method of the class 'Class' as:
          Employee obj = (Employee)c.newInstance();
4.By cloning an already available object,We can create another object. Creating exact copy of an existing object is called "cloning".
                    Employee obj1 = new Employee();
                    Employee obj2 = (Employee)obj1.clone();
Inheritance
When one object acquires all the properties and behaviours of parent object i.e. known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism
Polymorphism
When one task is performed by different ways
Abstraction
Hiding internal details and showing functionality is known as abstraction.
Encapsulation
Binding (or wrapping) code and data together into a single unit is known as encapsulation

No comments:

Post a Comment