OOPS JAVA Notes for B-Tech , Bsc and Bca students.

 

  


What Is Java ?

* It is a class based high level object oriented language.

* It is develop by James Gosling , Patrik Naughton and Mike Sheridan.

* Developed by the company Sun Micro System in 1995.

* Handed by oracle in 2010.

* Java Compilar written in C language.

Flavour Of Java :

1. Core java (Standard)

2. Advance java (Entreprise)

3.Android java (Micro)

Features of Java : 

1. Object oriented

2. Platform independent

3. Case sensitive

4. Garbage collection

5.Secure language

6. Portable

7. High performance

8. Robust

-----------------------------------

JDK: It provide all the tools which works with java.

JRE:- It provide environment in which java program was execute or run.

JVM:- It allow java program to run on any device and to manage program memory.

JIT:-  It stands for Just in time compilar. It is a part of JVM. Jvm execute bite code aqnd execution of bit code is slower than execution of machine code because JVM first translate bite code into machine code and JIT helps JVM by compilling currently execution bit code into machine code by improving performance of JVM.

--------------------------------------------------------

Variable In Java : Variable is the name of the memory location. In other word, we can say that it is user defined name which is given by user. It can store any type of values.

Three types of variables-

1. Local Variable - A local variable declared inside the body of the method.

Syntex- 

       void B (int a)

{

int x ;

}


2. Instance Variable- A variable which is declared inside the class but outside of all the method called Instance variable.

Syntex-

class A

{

int a ;

public static void main(String args[])

{}

}


3. Static Variable- A variable which is declared with the help of static keyword.

Syntex- static int a;


---------------------------------

Java Tokens : Tokens is the smallest element or unit of a program that is identified by the compilar. Every java statement are created using tokens.

Types-

1. Keywords-  They are the reerved words whose meaning is already defined in the compilar.

example- class, if, else, etc

2. Identifier- It is the name of the variable, method, class, package or interface that is used for the purpose of identification.

3.Operator-  It is a symbol that is used to perform operations according to user requirements.

-------------------------------------

String :- Java String are object that allows us to store sequence of character which may contain alpha numeric values enclosed in double quotes (" ").

* String are immutable in nature.

* It contain method that can perform certain operation in string.

----------------------------------------

Inheritance:- When we construct a new class from existing class in such a way that the new class access all the features and property of  existing class called Inheritance.

* In java extends keyword is used to perform inheritance.

* It provide code reuseability.

Syntex- 

class A  \\ superclass

{}

class B extends A   \\ sub-class

{}

Types of inheritance-

1. Simple Inheritance: Contain one super class and only one sub class.

2. Multi-level Inhe.: Only one super class and multiple sub class.

3.Multiple Inheritance: Contain Multiple superclass but one sub class.

4.Hierarchical Inheritance: Only one superclass and all subclass directly extends to superclass

------------------------------

Polymorphism:- Poly means many and morphism means forms. It refers to the same objects having different behaviours.

Two types of polymorphism-

1. Compile Time Polymorphism: A Polymorphism which exists at the time of compilation is called compile time polymorphism.

* Compile time achieved by Method Overloading

Method Overloading:- Whenever a class contain more than one method with same name and different type of parameter called Method Overloading.

Example-

class A

{

void add()

{

int a=10,b=20,c;

c=a+b;

System.out.println(c);

}

void add(int x, int y)

{

int c;

c=x+y;

System.out.println(c);

}

void add(int x, double y)

{

double c;

c=x+y;

System.out.println(c);

}

public static void main(String args[])

{

A r=new A();

r.add();

r.add(100,200);

r.add(50,42.5);

}

}

------------------------

Comments

Popular posts from this blog

Python Notes for B-Tech , Bsc , Bca....

Software Engineering Full Notes... B-Tech (C.S.) , Bsc (CS) , BCA....

Data Mining Assignment