SlideShare a Scribd company logo
WELCOME
INTRODUCTION
Object
oriented
programing
java
PRINCIPLES
 Encapsulation:
 Mechanism that binds code and the data together and keeps both safe from outside
interference and misuse.
 Inheritance:
 the process by which one object acquires the properties of another object.
 Polymorphism:
 One interface, multiple methods.
EXAMPLES
Encapsulation:
public class Student{
private String name;
public String getName(){
return name;
}
public void setName(String name){
this.name=name
}
}
class Test{
public static void main(String[] args){
Student s=new Student();
s.setname("vijay");
System.out.println(s.getName());
}
}
EXAMPLES
Inheritance:
class Employee{
float salary=40000;
}
class Programmer extends Employee{
int bonus=10000;
public static void main(String args[]){
Programmer p=new Programmer();
System.out.println("Programmer salary is:"+p.salary);
System.out.println("Bonus of Programmer is:"+p.bonus);
}
}
EXAMPLES
Polymorphism:
class Bike{
void run(){
System.out.println("running");
}
}
class Splender extends Bike{
void run(){
System.out.println("running safely with 60km");
}
public static void main(String args[]){
Bike b = new Splender();
b.run();
}
}
ABSTRACTION IN JAVA
Abstraction is a process of hiding the implementation details and showing only
functionality to the user.
Ways to achieve Abstraction:
Abstract class
Interface
 Abstract class:
A class that is declared as abstract is known as abstract class. It needs to be extended
and its method need to be implemented.
Example: abstract class Bike
{
}
Abstract method:
A method that is declared as abstract and does not have implementation is known as
abstract method.
Example: abstract void run( );
 Example: ( Abstract class )
abstract class Bike{
abstract void run();
}
class Honda4 extends Bike{
void run(){
System.out.println("running safely..");
}
public static void main(String args[]){
Bike obj = new Honda4();
obj.run();
}
} ref: http://www.javatpoint.com/abstract-class-in-java
INTERFACE IN JAVA
An interface in java is a blueprint of a class.
It has:
 Static constants
 Abstract methods
Reasons to use:
 Achieve fully abstraction
 To support the functionality of multiple inheritance
 To achieve loose coupling
Relationship between classes and interfaces:
ref: http://www.javatpoint.com/interface-in-java
EXCEPTION & EXCEPTION HANDLING
Exception is an abnormal condition.
In java, exception is an event that disrupts the normal flow of the program. It is an
object which is thrown at runtime.
Examples:
 ArithmaticException
 NullPointerException
 NumberFormatException e.t.c
And the process we use to handle those exceptions is called
Exception handling.
KEYWORDS
 We use five keywords to handle exceptions in java:
Try
Catch
Finally
Throw
Throws
General form of an exception-handling block:
try {
// block of code to monitor for errors
}
catch (ExceptionType1 exOb) {
// exception handler for ExceptionType1
}
catch (ExceptionType2 exOb) {
// exception handler for ExceptionType2
}
finally {
// block of code to be executed after try block ends
}
Thank you everybody !!!
Have a Good Day!
For contact: facebook.com/pritom.chaki.77
pritom.cse.diu@gamil.com

More Related Content

PPTX
ODP
OOP java
PPTX
oops concept in java | object oriented programming in java
PPTX
Introduction to Object Oriented Programming
PPTX
Interface in java ,multiple inheritance in java, interface implementation
PPTX
Java OOP Concept
PPT
Unit 3 Java
PPTX
General oops concepts
OOP java
oops concept in java | object oriented programming in java
Introduction to Object Oriented Programming
Interface in java ,multiple inheritance in java, interface implementation
Java OOP Concept
Unit 3 Java
General oops concepts

What's hot (20)

PPTX
the Concept of Object-Oriented Programming
PPTX
Structure of java program diff c- cpp and java
PPTX
concept of oops
PDF
Object Oriented Concepts in Real Projects
DOC
How would you implement multiple inheritance in java
PPSX
C#, OOP introduction and examples
PPT
Lecture 2
PDF
Classes, objects, methods, constructors, this keyword in java
PPTX
Inheritance in oops
PPTX
Abstract Class Presentation
PPTX
Inheritance in JAVA PPT
PDF
Multiple Inheritance
PDF
Implementation of oop concept in c++
PPTX
Friend function & friend class
PPT
Java interfaces & abstract classes
PPT
20. Object-Oriented Programming Fundamental Principles
PPTX
Oops concept in c++ unit 3 -topic 4
PPT
Object Oriented Concepts and Principles
PPT
friend function(c++)
the Concept of Object-Oriented Programming
Structure of java program diff c- cpp and java
concept of oops
Object Oriented Concepts in Real Projects
How would you implement multiple inheritance in java
C#, OOP introduction and examples
Lecture 2
Classes, objects, methods, constructors, this keyword in java
Inheritance in oops
Abstract Class Presentation
Inheritance in JAVA PPT
Multiple Inheritance
Implementation of oop concept in c++
Friend function & friend class
Java interfaces & abstract classes
20. Object-Oriented Programming Fundamental Principles
Oops concept in c++ unit 3 -topic 4
Object Oriented Concepts and Principles
friend function(c++)
Ad

Viewers also liked (20)

PDF
Chapter1 Introduction to OOP (Java)
PPT
General OOP concept [by-Digvijay]
PPT
implementing oop_concept
PPTX
Object Oriented Concept
PPT
Basic concepts of object oriented programming
PPTX
Introduction to Object Oriented Programming
PPT
Object Oriented Programming Concepts
PDF
Calendar class in java
ODT
Seminar report
PPTX
object oriented programming(syed munib ali 11b-023-bs)
PPTX
Usol seminar presentation
PDF
Computer Security Seminar: Protect your internet account information
PPTX
Parameterized Constructor
PPT
Oops
PDF
03. oop concepts
PDF
OOP Basic
PPTX
Oop design principles
PPT
java Oops.ppt
PPT
SystemVerilog OOP Ovm Features Summary
Chapter1 Introduction to OOP (Java)
General OOP concept [by-Digvijay]
implementing oop_concept
Object Oriented Concept
Basic concepts of object oriented programming
Introduction to Object Oriented Programming
Object Oriented Programming Concepts
Calendar class in java
Seminar report
object oriented programming(syed munib ali 11b-023-bs)
Usol seminar presentation
Computer Security Seminar: Protect your internet account information
Parameterized Constructor
Oops
03. oop concepts
OOP Basic
Oop design principles
java Oops.ppt
SystemVerilog OOP Ovm Features Summary
Ad

Similar to Object Orinted Programing(OOP) concepts \ (20)

PPTX
Lecture-on-Object-Oriented-Programming-Language-Java.pptx
PPTX
Java OOPS Concept
PDF
Abstraction in Java: Abstract class and Interfaces
PPTX
OOP with Java - Abstract Classes and Interfaces
DOCX
Core java notes with examples
PPT
ABSTRACT CLASSES AND INTERFACES.ppt
PPTX
OOPS (Object Oriented Programming System) CONCEPTS
PPTX
06_OOVP.pptx object oriented and visual programming
PPTX
chapter 5 concepts of object oriented programming
PPT
oops with java modules i & ii.ppt
PPSX
Oop features java presentationshow
PPTX
Abstraction encapsulation inheritance polymorphism
PPTX
More oop in java
PPTX
abstract,final,interface (1).pptx upload
PPTX
Core java oop
DOCX
Master of Computer Application (MCA) – Semester 4 MC0078
PPT
Chapter 5 (OOP Principles).ppt
PDF
Principles of Object Oriented Programming
PPTX
Abstract class and interface
PDF
Programming Laboratory Unit 1.pdf
Lecture-on-Object-Oriented-Programming-Language-Java.pptx
Java OOPS Concept
Abstraction in Java: Abstract class and Interfaces
OOP with Java - Abstract Classes and Interfaces
Core java notes with examples
ABSTRACT CLASSES AND INTERFACES.ppt
OOPS (Object Oriented Programming System) CONCEPTS
06_OOVP.pptx object oriented and visual programming
chapter 5 concepts of object oriented programming
oops with java modules i & ii.ppt
Oop features java presentationshow
Abstraction encapsulation inheritance polymorphism
More oop in java
abstract,final,interface (1).pptx upload
Core java oop
Master of Computer Application (MCA) – Semester 4 MC0078
Chapter 5 (OOP Principles).ppt
Principles of Object Oriented Programming
Abstract class and interface
Programming Laboratory Unit 1.pdf

More from Pritom Chaki (9)

PPTX
Blockchain Technology and its Business Application
PPTX
Matrix and It's Applications
PPTX
Social Media & Privacy in Bangladesh
PPTX
Leadership of Lord Krishna
PPTX
Presentation skill-development (BUP)
PPTX
Global and local alignment (bioinformatics)
PPTX
Transmission media (data communication)
PPT
OSI 7 Layer Model
PPTX
Object Oriented Programing JAVA presentaion
Blockchain Technology and its Business Application
Matrix and It's Applications
Social Media & Privacy in Bangladesh
Leadership of Lord Krishna
Presentation skill-development (BUP)
Global and local alignment (bioinformatics)
Transmission media (data communication)
OSI 7 Layer Model
Object Oriented Programing JAVA presentaion

Recently uploaded (20)

PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Cell Structure & Organelles in detailed.
PPTX
Institutional Correction lecture only . . .
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Classroom Observation Tools for Teachers
PDF
Business Ethics Teaching Materials for college
PDF
O7-L3 Supply Chain Operations - ICLT Program
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Anesthesia in Laparoscopic Surgery in India
O5-L3 Freight Transport Ops (International) V1.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Cell Structure & Organelles in detailed.
Institutional Correction lecture only . . .
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
VCE English Exam - Section C Student Revision Booklet
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Module 4: Burden of Disease Tutorial Slides S2 2025
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Classroom Observation Tools for Teachers
Business Ethics Teaching Materials for college
O7-L3 Supply Chain Operations - ICLT Program

Object Orinted Programing(OOP) concepts \

  • 3. PRINCIPLES  Encapsulation:  Mechanism that binds code and the data together and keeps both safe from outside interference and misuse.  Inheritance:  the process by which one object acquires the properties of another object.  Polymorphism:  One interface, multiple methods.
  • 4. EXAMPLES Encapsulation: public class Student{ private String name; public String getName(){ return name; } public void setName(String name){ this.name=name } } class Test{ public static void main(String[] args){ Student s=new Student(); s.setname("vijay"); System.out.println(s.getName()); } }
  • 5. EXAMPLES Inheritance: class Employee{ float salary=40000; } class Programmer extends Employee{ int bonus=10000; public static void main(String args[]){ Programmer p=new Programmer(); System.out.println("Programmer salary is:"+p.salary); System.out.println("Bonus of Programmer is:"+p.bonus); } }
  • 6. EXAMPLES Polymorphism: class Bike{ void run(){ System.out.println("running"); } } class Splender extends Bike{ void run(){ System.out.println("running safely with 60km"); } public static void main(String args[]){ Bike b = new Splender(); b.run(); } }
  • 7. ABSTRACTION IN JAVA Abstraction is a process of hiding the implementation details and showing only functionality to the user. Ways to achieve Abstraction: Abstract class Interface
  • 8.  Abstract class: A class that is declared as abstract is known as abstract class. It needs to be extended and its method need to be implemented. Example: abstract class Bike { } Abstract method: A method that is declared as abstract and does not have implementation is known as abstract method. Example: abstract void run( );
  • 9.  Example: ( Abstract class ) abstract class Bike{ abstract void run(); } class Honda4 extends Bike{ void run(){ System.out.println("running safely.."); } public static void main(String args[]){ Bike obj = new Honda4(); obj.run(); } } ref: http://www.javatpoint.com/abstract-class-in-java
  • 10. INTERFACE IN JAVA An interface in java is a blueprint of a class. It has:  Static constants  Abstract methods Reasons to use:  Achieve fully abstraction  To support the functionality of multiple inheritance  To achieve loose coupling
  • 11. Relationship between classes and interfaces: ref: http://www.javatpoint.com/interface-in-java
  • 12. EXCEPTION & EXCEPTION HANDLING Exception is an abnormal condition. In java, exception is an event that disrupts the normal flow of the program. It is an object which is thrown at runtime. Examples:  ArithmaticException  NullPointerException  NumberFormatException e.t.c And the process we use to handle those exceptions is called Exception handling.
  • 13. KEYWORDS  We use five keywords to handle exceptions in java: Try Catch Finally Throw Throws
  • 14. General form of an exception-handling block: try { // block of code to monitor for errors } catch (ExceptionType1 exOb) { // exception handler for ExceptionType1 } catch (ExceptionType2 exOb) { // exception handler for ExceptionType2 } finally { // block of code to be executed after try block ends }
  • 15. Thank you everybody !!! Have a Good Day! For contact: facebook.com/pritom.chaki.77 pritom.cse.diu@gamil.com