OOPs : Object Oriented Programming

Object : Any real entity which is having some states/properties & behavior

States/Properties: > Variables (int, String, double)





nipsize  > Nouns


Behavior/Actions/verbs: > Methods/Functions





So if you combine states/properties & behavior into single unit then it will be called as 


Class is a blue print of a Object.

Static KeyWord:  // ClassName.VariableName   or ClassName.MethodName

1.It is used for Memory Management

2.It allows quick access to method or variable

// ClassName.VariableName

3.Easy to Change



OOP's Concepts:





What is inheritance : It is concept by which Properties of Parent is Automatic get transfer to its child

Loan Management System:

Class Loan


 // Common Things : 200 loc


class PLoan extends Loan class Eloan extends Loan

{ {

//300 loc //300 loc

} }

class VLoan extends Loan Class HLoan extends Loan

{ {

//300 loc //300 loc

} }

Total LOC: 2000 LOC

Development Hours : 20 hrs

Compiler becomes Slow

Total LOC: 1400 LOC > after using inheritance

Developement Hours : 15 hrs

Compiler is Fast

Code will become easy to Change/Update

IS-A relationship

Every Vehicle Loan IS-A Loan

Every Education Loan IS-A Loan

Every Personal Loan IS-A Loan

Every Loan IS-A Vehicle Loan > Not true

Vehicle Class

Car Class

Every Car IS-A Vehicle   

Every Vehicle is not a Car




Poly- Many

Morphism - forms

Testing: A process in which we compare expected & Actual Behavior

1.Method Overriding

Needs two Classes with Parent & Child relationship

There will One Method in Parent & same n Child also but with different implementation/coding.

2.Method OverLoading

Overriding Overloading

1.Two Classes with Parent & Child 1.Only One Class needed


2.Same Method is Present in 2.In Same class we will same method name

both class(in Parent as well as in Child) with different argument/Parameter


You need to Make Animal Parent Class & Dog,Cat will be Child Class.

And You need to implement method overriding Concept.




Basic Encapsulation:

1.Combining Data Members + Behavior(Methods) into Single unit 

Encapsulation :  Hiding importanat data(unnessary things)

Tight Encapsulation :

public : Visible to all

protected / default : Visible within Package

private : Visible within Class


Interface : It is set of rules/protocol/ guidelines


Why all GSM SIM Sim Supports All GSM Mobile

Why all USB Mouse Supports All laptop/Computer



Interface: Making protocol of method Names


incoming call

outgoing call

incoming sms

outgoing sms

D1 D2 D3 D4

Jseries Eseries Galaxy Guru

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

in_call incoming_call in_calling incoming_calling

in_sms incoming_sms in_smsing incoming_smsing

Child c=new Child();

Parent p=new Child()

Basic_feature b=new Jseries();

Basic_feature b=new Eseries();

WebDriver is a Interface & ChromeDriver, FirefoxDriver, Opera Driver are Classes which implements WebDriver

WebDriver driver=new ChromeDriver(); // Parent p=new Child()

Note: Here, Child Specific Method will get hide.

Interface Abstract CLass

1.Only Declarations are there It can have method with body & without body

(No Body for Method)

2. 'implements' keyword used 'extends' keyword is used

  for Child Class

3.Developer do not know 3.When Devloper knows implementation of 

Coding for any function some function & don't know for some function

Or While making common

protocol for all developer

Exception Handling is used to avoid abnormal termination of Programme


Checked Exeption : Compiler gives error before running code (High Chance Occurance)

UnChecked Exeption : Compiler do not give error before running code (Less Chance Occurance) i.e ArithmeticException