training on java niit (sahil gupta 9068557926)

Post on 10-May-2015

840 Views

Category:

Education

4 Downloads

Preview:

Click to see full reader

DESCRIPTION

Training PPT on JAVA in NIIT

TRANSCRIPT

TRAINING ON JAVA

UNDER THE GUIDENCE OFPRINCE MALHOTRA (Manager)

JAVA

Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows , Mac OS, and the various versions of UNIX. Used in :#Desktop Applications#Web application #robotics#Games#Mobile

FEATURES OF JAVA

#SIMPLE#OBJECT ORIENTED#PLATFORM INDEPENDENT#SECURED#MULTITHREADED#ROBUST

JRE

OOPS

Designing programs using classes and objects..Simplify software development and maintenance by providing concepts:#object#class#inheritance#polymorphism#Abstraction#Encapsulation

ABSTRACTIONAbstraction is a process of hiding internal details and showing only functionality to the user..Ways to achieve abstraction:# Abstract class# Interface abstract class Bike { abstract void run(); }class Honda extends Bike {void run() { System.out.println(“run safely”); }public static void main(String args[]) {Bike obj=new Bike();obj.run();}}

INTERFACEIt is a mechanism to achieve fully abstraction and multiple inheritance in java...

interface Printable { void print(); }interface Showable { void show(); }class A implements Printable,Showable {print void print(){ System.out.println(“hello”); }print void show(){ System.out.println(“Welcome”); }public static void main(String [] args){A obj= new A();obj.print() ; obj.show() ; }}

RUN TIME POLYMORPHISM

class Bike {void run() { System.out.println(“running ”); }class Splender extends Bike {void run() { System.out.println(“running safely”); }public Static void main(String []args){ Bike obj=new Splender ();obj.run();}}

CONSTRUCTORS

Default Constructor: class B{B(){ System.Out.Println(“Welcome”)}public Static void main(){B obj=new B(); }}

Parameterized Constructorclass S{ int id;String name;

S(int i, String n){ id=i;name=n;}void display(){ System.out.println(id+” ” +name);}}

CONSTRUCTOR OVERLOADING

class S{Int id; String name; int age;}S(int i,String n,int a) { name=n; id=i; age=a; }S(int i; String n) { name=n; id=i; }void display(){ System.out.println (id+” ” +name” ”+age) ; }public Static void main(String args[]){S ob1=new S(111, “ keran”);S obj2=new S(231, “bhanu”, 23);obj1.display();obj2.display(); }}

STATIC KEYWORDStatic property is shared to all objects..class S {int rollno; String name; Static String college=ITS; }

EXCEPTION HANDLING

FIVE KEYWORDS USED IN EXCEPTION HANDLING

#try#catch#finally#throw#throws

EXAMPLEclass A{public Static void main(String []args) {int a=integer parse int(args[0]);int b=integer parse int(args[1]);int div=0;try{div=a/b;System.out.println(div); }catch(Arithmetic Exception e){ printStackTrace(); }System.out.println(“the race is on”);}}

THANKYOU

top related