Você está na página 1de 104

Sri Krishna I-Tech and

Management Solutions Pvt Ltd

JAVA
Programming

TIOBE Index for May 2015

Java Certification

Java Certification

OCP Java SE6 Certification Code

1Z0-851

Java Contents

Java Course Modules


1. Fundamentals of the java Programming Language, Java SE
6
2. Java Programming Language, Java SE 6
3. Web Component Development with Servlets & JSPs, Java
EE 6
4. Developing Application for the Java EE 6 Platform

JAVA
1. Fundamentals of the java Programming
Language, Java SE 6
2. Java Programming Language, Java SE 6

JAVA

Certifications

1. Fundamentals of the java Programming Language, Java SE 6

OCA

Java SE 6 Programmer

2. Java Programming Language, Java SE 6

OCP

Java SE 6 Programmer

Fundamentals of the java Programming


Language, Java SE 6
1. Explaining java technology.
2. Analyzing a problem and designing a solution.
3. Developing and testing the java technology
program.
4. Declaring, initializing, and using variables.
5. Creating and using objects.
6. Using operations and decision constructs.
7. Using loop constructs.
8. Developing and using methods.
9. Implementing encapsulations and constructors.
10. Creating and using arrays.
11. Implementing inheritance.

Java Programming Language, Java SE 6


1. Objects-oriented programming.
2. Identifiers, keywords, and types.
3. Expressions and flow control.
4. Arrays, class design, advanced class features.
5. Exceptions and assertions.
6. Collections and generics framework.
7. I/O fundamentals, console I/O and file I/O.
8. Building java GUIs using the Swing API.
9. Handling HUI-generated events.
10. GUI-based applications.
11. Threads.
12. Networking.

Java Contents

Java programming basics.

Value type and Reference type.

Methods and its related concepts.

Java programming basics.

Value type and Reference type.

Constructor
and its
related concepts.
Methods
and its related
concepts.

Inheritance
its types.
Constructor
and itsand
related
concepts.

Abstract
Abstract
class and
class
Interface
and Interface
concepts.concepts.

Inner
classes.
Inner
classes.

Exception
Handling.
Exception
Handling.

Multithreading.

Wrapper classes and String operations.

Collections Framework.

Garbage Collection.

Streams (File handling).

Multithreading.

Wrapper classes and String operations.

Collections Framework.

Garbage Collection.

Streams (File handling).

Applications

Console A/P (e.g.

Shop billing)

Windows A/P (e.g.

MS-word, Excel)

Web A/P (e.g.

Mobile A/P (e.g.

Gmail, Yahoo)
WhatsApp, Hangouts)

Programming Basics

Pointers
int

100;

char

S;

float

20.4f;

int

*x =

&a;

char

*y =

&b;

float

*z =

&c;

Value Type

Reference
Type

Object Oriented Programming

Class

Object

Class
class Student
{
int id;
void display()
{
cout<<id;
}
}

Blue Print

Platform Independence
JRE
JVM
Class
Class load
load

JDK
Source
Source code
code
(.java)
(.java)

Byte
Byte code
code
(.class)
(.class)

Object
Object creation
creation

Class and Objects

Object
House

CLASS

Object
House

Blue print
Object
House

Class
class Student
{
int id;
Student( void display()
)
{
{
cont<<id;
}
}
}

Blue Print

Class
Creating Object

class Student
{
int id;
Student()
{
}

Student
ob
1
Invoking Constructor

Pointers
int

*x;
Reference Type

Student

*ob;
Reference Type

Object Creation
Student

ob;
Object creation

new Student()

Object creation

Pointers
Student

ob;
Value Type

Student

*ptr = new Student();

Reference Type

C++
Student
*ob1;
Student
ob2;

C++ Reference
Creation
C++ Object
Creation

JAVA
Student
*ob1;

Student
ob2;

C++ Reference
Creation
C++ Object
Creation

Java Reference

Creation

C++
Student

ob;
Object creation

new Student()

Object creation

Java
Student

ob;
Reference

new Student()

Object
creation

Object

Student

ob = new Student();

Reference

Object Creation in Java

Student
ob = new
Student();

Object
class Student
{
int id;
Student()
{
}
}

Student

ob = new Student();

Instance (or) Object

Student

ob =

new Student();

ob.id=200;
ob.display();

Class
class Student
{
int id;
void display()
{
cout<<id;
}
}

Variables and
Methods

Types of Variables and Methods

Instance variable and Instance methods (nonstatic).

Class variable and Class methods (static).

Local variable.

class Demo
{
static int a;
int b;
}

Platform Independence
JRE
JVM
Class
Class load
load

JDK
Source
Source code
code
(.java)
(.java)

Byte
Byte code
code
(.class)
(.class)

Object
Object creation
creation

class Demo
{
static int a;
int b;
}

Demo.a = 5000;

Demo obj=new
Demo();
obj.b=1000;

Instance variable and method


class Demo
{
int a;
void sum()
{
cout<<a;
}
}

Demo o1=new Demo();


o1.a=1000;
o1.sum();
Demo o2=new Demo();
o2.a=3000;
o2.sum();
Demo

o1

o2

Class variable and method


class Demo
{
static int a;
static void sum()
{
cout<<a;
}
}

Demo.a = 5000;
Demo.sum();

Java Packages

java.lang.*;
Object
System

Printing Statement

System.out.println(Welcome);

System Class
class System
{
static int x;
static int y;
}

System.x=100;
System.y=100;

System Class

PrintStream

out=new PrintStream();

Object of PrintStream class

System Class

class System
{
static PrintStream
PrintStream();

out=new

PrintStream Class
class PrintStream
{
void println(int);
void println(String);
}

Application

Class

Variable (static)

System.out

Object of PrintStream Class

Application

Class

Variable (static)

System.out.println(Welcome);
Method
Object of PrintStream Class

Application
class Demo
{
}

class Demo extends Object


{
}
Default base class

import java.lang.*;
class Demo extends Object
{
Demo()
{
}

Object Creation
class A
{
}
class B extends
A
{
}

A
new A();
A

new B();

Reference
class A
{
}
class B extends
A
{
}

ob1;

ob2;

Reference
class A
{

A
A

}
class B extends
A
{
}

ob1;
A B
B

ob2;

Inheritance
class A
{
}
class B extends
A
{
}

A
A

A
B
o1 = new B();

A B

B
B

o2 = new B();

Inheritance
class A
{
}
class B extends A
{
}

A s1 = new B();
B s2 = (B)s1;

Inheritance

Up-casting

A s1 = new B();
B s2 = (B)s1;

Downcasting-casting

A class Object may be under


same-class reference or base-class
reference
A

r1 = new B();

r2 = new B();

A class Reference may contain


same-class Object
or sub-class Object
A

r1 = new A();

r2 = new B();

r1 = new B();
B class Object is stored under the Reference of class A

r2 = new B();
B class Object is stored under the Reference of class B

A r1 = new
A();
A class Reference is holding Object of class A

A r2 = new
A class
Reference is holding Object of class A
B();

Inheritance
class A
{
}
class B extends
A
{
}

A
A

A
o1 = new A();

A
B
A

A
o2 = new B();

Inheritance
class A
{
}
class B
{
}
class C
{
}

new A();
O

new B();
O

new C();

Inheritance
class A
{
}
class B
{
}
class C
{
}

Object o1=new
A();
O

Object o2=new
O
C
B();
Object o3=new

Inheritance
class A
{
}
class B
{
}
class C
{
}

Object s1 = new
A();
A

s2 = (A)s1;

Inheritance
class A
{
}

Up-casting

Object s1 = new
A();
A

s2 = (A)s1;

Downcasting-casting

Methods overloading

If a class have multiple methods by same name


but different parameters, it is known as
Method Overloading.
Increases the readability of the program.

Methods overloading

There are two ways to overload the method in java

1.By changing number of arguments


2.By changing the data type

Methods overloading
class Demo
{
void add()
{
}
void add(int x)
{
}
void add(int x,int y)
{
}

Methods overloading
class Demo
{
Demo o1=new
int x;
Demo();
void add()
o1.add();
{
System.out.println(Hai);
o1.add(50);
}
void add(int y)
{
this.x=y;
System.out.println(X :+x);
}
}

Methods
void calculation();

void calculation()
{
int a=200;
int b=400;
System.out.println(a+b);
}

Methods
void calculation();

void calculation()
{
int a=200;
int b=400;
S.o.p(a+b);
}

Method Declaration

Method Declaration

Method Definition

Methods
void calculation();

void calculation()
{
int a=200;
int b=400;
System.out.println(a+b);
}

Abstract Method

Concrete Method

Method Overriding
class A
{
void add()
{
System.out.println(Hai);
}
}
class B extends A
{
}

Method Overriding
class A
{
void add()
{
System.out.println(Hai);
}

}
class B extends A
{
void add()
{
System.out.println(Welcome);
}

Method Overriding
class A
{
void add();
}
class B extends A
{
}

Method Overriding
class A
{
void add();
}
class B extends A
{
void add()
{
System.out.println(Welcome);
}

Constructor
class A
{
int x;
A()
{
}
A(int y)
{
this.x=y;
}
}

A o1=new A();
A o2=new A(40);

Inheritance

Single

Multilevel

Hierarchal

Multiple

Hybrid

Inheritance

B
B
C

Multiple Inheritance
add();

add();

C
add()
{
}

Methods
void calculation();

void calculation()
{
int a=200;
int b=400;
System.out.println(a+b);
}

Methods
abstract void calculation();

Abstract Class
abstract class Car
{
abstract void door();
abstract void glass();
}

Abstract Class
abstract class Car
{
abstract void door();
abstract void glass();
void wheel()
{
System.out.println(Wheel);
}
}

Abstract Class
CAR

Benz

Audi

BMW

Abstract Class
CAR

Benz

Audi

void door();
void
glass();

BMW

Abstract Class
CAR

Benz
void door();
void glass();

Audi
void door();
void glass();

void door();
void
glass();

BMW
void door();
void glass();

Abstract Class
class Lancer
{

extends

Car

void door()
{
System.out.println(Lancer door);
}
void glass()
{
System.out.println(Lancer glass);
}

Abstract Class vs Interface


Abstract Class

Contains abstract
and concrete methods.

Interface

Contains only
abstract methods.

Interface

CAR

Benz
void door();
void glass();

Audi
void door();
void glass();

void door();
void
glass();

BMW
void door();
void glass();

Interface
interface Car
{
void door();
void glass();

Interface
interface Car
{
public abstract
public abstract
}

void door();
void glass();

Default

Interface
class Lancer
{

implements

Car

public void door()


{
System.out.println(Lancer door);
}
public void glass()
{
System.out.println(Lancer glass);
}

Multiple Inheritance
add();

add();

C
add()
{
}

Object Creation
interface Mail
{
void register();
void
validation();
}
abstract class Car
{
void door();
void glass();
}

new Mail();

new Car();

Object Creation
interface Mail
{
void register();
void
validation();
}
abstract class Car
{
void door();
void glass();
}

new Yahoo();

new Benz();

Object Creation

Mail ob1 = new Mail();

Car c1 = new Car();

Object Creation

Mail ob1 = new Yahoo();

Car c1 = new Benz();

Inner Classes

class A
{
}

Inner Classes
class A
{
class B
{
}
}

Inner Classes
1.

Non-Static

inner class

2.

Static

inner class

3.

Anonymous

inner class

4.

Method Local

inner class

Non-Static
class A
{
class B
{
}
}

Static
class A
{
static class B
{
}
}

Annonymous Inner Class

class A
{
{
}
}

Method Local Inner Class

class A
{
void test()
{
class Test
{
}
}

Você também pode gostar