SlideShare una empresa de Scribd logo
1 de 35
Java is an Object-Oriented Language ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Objects everywhere... Real world entities
World ,[object Object],[object Object],[object Object],[object Object],[object Object]
Describing the world ,[object Object],[object Object],[object Object],[object Object],[object Object]
Objects have identity... Our house The neighbour’s cat Hasan’s computer Merhababen Ayse My book Dombo the elephant
Objects have state... Red Lying Happy Hooked ill Broken
Objects have behavior…. Grrrrrrrr Vroemm Hello,  I am John Nice to  meet you da da …
Object Properties ,[object Object],[object Object],[object Object],myLamp on off Object is an abstraction of a real world entity
Introduction to Objects ,[object Object],[object Object],[object Object],[object Object],[object Object]
Objects and Classes Bank   Account A class (the concept) John’s Bank Account Balance: $5,257 An object (the realization) Bill’s Bank Account Balance: $1,245,069 Mary’s Bank Account Balance: $16,833 Multiple objects from the same class
Java OOP terminology ,[object Object],[object Object],[object Object],data methods ,[object Object],[object Object],[object Object]
Java OOP Software ,[object Object],[object Object],[object Object],One object will send a message to another object asking it to do a particular task. The first object does not need to know how the task is done (only how to request that it be done.) This corresponds to calling one of the  second object’s methods! Created (instantiated) from class definitions Person “ David” David: Say your name Ayse David
Abstraction ,[object Object],[object Object],[object Object],[object Object],[object Object],Abstraction A car consists of four wheels an engine, accumulator and brakes.
Multiple Abstractions ,[object Object],[object Object],[object Object],[object Object],[object Object]
Choosing Abstractions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Object-Oriented Model methods data Object boundary
Example: Pencil location direction penDown home up down write
Encapsulation ,[object Object],[object Object],[object Object],[object Object],location direction penDown home up down write public private
Programming Implications ,[object Object],[object Object],[object Object],[object Object]
Car Objects
Defining class Car ,[object Object],[object Object]
Class Car  Car color speed power drive turn right turn left stop attributes operations class name
in Java Car String  color int  speed int  power drive() turnRight() turnLeft() stop() attributes or  instance variables methods class name
Java Syntax ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Car String  color int  speed int  power drive() turnRight() turnLeft() stop()
Class Pencil Pencil int location String direction home() up() down() write() attributes methods Name
Declaring objects ,[object Object],[object Object],Car String  color int  speed int  power drive() turnRight() turnLeft() stop() new
Java's "Building Blocks" ,[object Object],[object Object],[object Object],[object Object],[object Object]
Primitive Data ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Declaring object variables ,[object Object],[object Object],[object Object]
Declaring Objects Class Person ayse; Person String name String birthDate int age getName() getAge … . ayse is of Class
Creating Objects ,[object Object],ayse = new Person(); ,[object Object],[object Object],[object Object],ayse Class Object instance of refers to Person ayse = new Person(); is of Class Person String name String birthDate int age getName() getAge … .
Declaring and Creating Objects Class karanfil = new Flower(); Flower karanfil; Flower int age int length int weight getAge() getLength() … . Object instance of refers to karanfil is of Class
Basic approach ,[object Object],[object Object],[object Object],[object Object]
Using objects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example ayse Class Object instance of refers to is of Class ayse = new Person(); Person ayse; ayse.setName( “Ayse Engin“) ; ayse.setAge(24); Person String name String birthDate int age setName(String name) setAge(int age) getName() … . Ayse Engin 24

Más contenido relacionado

La actualidad más candente

Classes in c++ (OOP Presentation)
Classes in c++ (OOP Presentation)Classes in c++ (OOP Presentation)
Classes in c++ (OOP Presentation)
Majid Saeed
 
Classes and objects till 16 aug
Classes and objects till 16 augClasses and objects till 16 aug
Classes and objects till 16 aug
shashank12march
 

La actualidad más candente (19)

Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
 
C++ classes
C++ classesC++ classes
C++ classes
 
Python Class | Python Programming | Python Tutorial | Edureka
Python Class | Python Programming | Python Tutorial | EdurekaPython Class | Python Programming | Python Tutorial | Edureka
Python Class | Python Programming | Python Tutorial | Edureka
 
class c++
class c++class c++
class c++
 
Object Oriented Programming_Lecture 2
Object Oriented Programming_Lecture 2Object Oriented Programming_Lecture 2
Object Oriented Programming_Lecture 2
 
JavaScript OOPS Implimentation
JavaScript OOPS ImplimentationJavaScript OOPS Implimentation
JavaScript OOPS Implimentation
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Classes in c++ (OOP Presentation)
Classes in c++ (OOP Presentation)Classes in c++ (OOP Presentation)
Classes in c++ (OOP Presentation)
 
Write First C++ class
Write First C++ classWrite First C++ class
Write First C++ class
 
‫Object Oriented Programming_Lecture 3
‫Object Oriented Programming_Lecture 3‫Object Oriented Programming_Lecture 3
‫Object Oriented Programming_Lecture 3
 
Java OO Revisited
Java OO RevisitedJava OO Revisited
Java OO Revisited
 
Object and class in java
Object and class in javaObject and class in java
Object and class in java
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Seminar on java
Seminar on javaSeminar on java
Seminar on java
 
Python - object oriented
Python - object orientedPython - object oriented
Python - object oriented
 
Oop in kotlin
Oop in kotlinOop in kotlin
Oop in kotlin
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming Course
 
Classes and objects till 16 aug
Classes and objects till 16 augClasses and objects till 16 aug
Classes and objects till 16 aug
 
Logic and Coding of Java Interfaces & Swing Applications
Logic and Coding of Java Interfaces & Swing ApplicationsLogic and Coding of Java Interfaces & Swing Applications
Logic and Coding of Java Interfaces & Swing Applications
 

Destacado

abstract window tool kit
abstract window tool kitabstract window tool kit
abstract window tool kit
jent46
 
Casos Uso Ejercicios en java
Casos Uso Ejercicios en javaCasos Uso Ejercicios en java
Casos Uso Ejercicios en java
jent46
 
Estudio De La Vida
Estudio De La VidaEstudio De La Vida
Estudio De La Vida
jent46
 
Bases Datos en java
Bases Datos en javaBases Datos en java
Bases Datos en java
jent46
 
diagramas de interaccion
diagramas de interacciondiagramas de interaccion
diagramas de interaccion
jent46
 
Clases Anidadas en java
Clases Anidadas en javaClases Anidadas en java
Clases Anidadas en java
jent46
 
diagrama de clases
diagrama de clasesdiagrama de clases
diagrama de clases
jent46
 
Colecciones en java
Colecciones en javaColecciones en java
Colecciones en java
jent46
 
Manejo Eventos en java
Manejo Eventos en javaManejo Eventos en java
Manejo Eventos en java
jent46
 
modelamientyo dinamico
modelamientyo dinamicomodelamientyo dinamico
modelamientyo dinamico
jent46
 
Archivos aleatorios en java
Archivos aleatorios en javaArchivos aleatorios en java
Archivos aleatorios en java
jent46
 
Buceo En Aguas Profundas
Buceo En Aguas ProfundasBuceo En Aguas Profundas
Buceo En Aguas Profundas
jent46
 
Excepciones en java
Excepciones en javaExcepciones en java
Excepciones en java
jent46
 
Manejo Eventos en java
Manejo Eventos en javaManejo Eventos en java
Manejo Eventos en java
jent46
 
programacion orientada a objetos
programacion orientada a objetosprogramacion orientada a objetos
programacion orientada a objetos
jent46
 
Applets
AppletsApplets
Applets
jent46
 
Threads en java
Threads en javaThreads en java
Threads en java
jent46
 
transporte Celular
transporte Celulartransporte Celular
transporte Celular
jent46
 
Codigo Genetico
Codigo GeneticoCodigo Genetico
Codigo Genetico
jent46
 

Destacado (20)

abstract window tool kit
abstract window tool kitabstract window tool kit
abstract window tool kit
 
Casos Uso Ejercicios en java
Casos Uso Ejercicios en javaCasos Uso Ejercicios en java
Casos Uso Ejercicios en java
 
Estudio De La Vida
Estudio De La VidaEstudio De La Vida
Estudio De La Vida
 
Bases Datos en java
Bases Datos en javaBases Datos en java
Bases Datos en java
 
diagramas de interaccion
diagramas de interacciondiagramas de interaccion
diagramas de interaccion
 
Clases Anidadas en java
Clases Anidadas en javaClases Anidadas en java
Clases Anidadas en java
 
diagrama de clases
diagrama de clasesdiagrama de clases
diagrama de clases
 
Colecciones en java
Colecciones en javaColecciones en java
Colecciones en java
 
ADN y Código Genético
ADN y Código GenéticoADN y Código Genético
ADN y Código Genético
 
Manejo Eventos en java
Manejo Eventos en javaManejo Eventos en java
Manejo Eventos en java
 
modelamientyo dinamico
modelamientyo dinamicomodelamientyo dinamico
modelamientyo dinamico
 
Archivos aleatorios en java
Archivos aleatorios en javaArchivos aleatorios en java
Archivos aleatorios en java
 
Buceo En Aguas Profundas
Buceo En Aguas ProfundasBuceo En Aguas Profundas
Buceo En Aguas Profundas
 
Excepciones en java
Excepciones en javaExcepciones en java
Excepciones en java
 
Manejo Eventos en java
Manejo Eventos en javaManejo Eventos en java
Manejo Eventos en java
 
programacion orientada a objetos
programacion orientada a objetosprogramacion orientada a objetos
programacion orientada a objetos
 
Applets
AppletsApplets
Applets
 
Threads en java
Threads en javaThreads en java
Threads en java
 
transporte Celular
transporte Celulartransporte Celular
transporte Celular
 
Codigo Genetico
Codigo GeneticoCodigo Genetico
Codigo Genetico
 

Similar a java

Hibernate Training Session1
Hibernate Training Session1Hibernate Training Session1
Hibernate Training Session1
Asad Khan
 
OOP programming
OOP programmingOOP programming
OOP programming
anhdbh
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
Aravinth NSP
 
Object-Oriented Concepts
Object-Oriented ConceptsObject-Oriented Concepts
Object-Oriented Concepts
Abdalla Mahmoud
 

Similar a java (20)

COMP111-Week-1_138439.pptx
COMP111-Week-1_138439.pptxCOMP111-Week-1_138439.pptx
COMP111-Week-1_138439.pptx
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
 
Oop java
Oop javaOop java
Oop java
 
Hibernate Training Session1
Hibernate Training Session1Hibernate Training Session1
Hibernate Training Session1
 
Classes-and-Object.pptx
Classes-and-Object.pptxClasses-and-Object.pptx
Classes-and-Object.pptx
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
OOP programming
OOP programmingOOP programming
OOP programming
 
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1
 
javaopps concepts
javaopps conceptsjavaopps concepts
javaopps concepts
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
07slide.ppt
07slide.ppt07slide.ppt
07slide.ppt
 
O6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdfO6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdf
 
JAVA-PPT'S.pdf
JAVA-PPT'S.pdfJAVA-PPT'S.pdf
JAVA-PPT'S.pdf
 
Lecture 01 - Basic Concept About OOP With Python
Lecture 01 - Basic Concept About OOP With PythonLecture 01 - Basic Concept About OOP With Python
Lecture 01 - Basic Concept About OOP With Python
 
Ooad notes
Ooad notesOoad notes
Ooad notes
 
java tr.docx
java tr.docxjava tr.docx
java tr.docx
 
Java: Objects and Object References
Java: Objects and Object ReferencesJava: Objects and Object References
Java: Objects and Object References
 
Object-Oriented Concepts
Object-Oriented ConceptsObject-Oriented Concepts
Object-Oriented Concepts
 

Más de jent46

relacion de las matematicas con la biologia y la quimica
relacion de las matematicas con la biologia y la quimicarelacion de las matematicas con la biologia y la quimica
relacion de las matematicas con la biologia y la quimica
jent46
 
Interaccion en java
Interaccion en javaInteraccion en java
Interaccion en java
jent46
 
Clasifseresvivos
ClasifseresvivosClasifseresvivos
Clasifseresvivos
jent46
 
Mitosis y Meiosis
Mitosis y MeiosisMitosis y Meiosis
Mitosis y Meiosis
jent46
 
fotosintesis
fotosintesisfotosintesis
fotosintesis
jent46
 
respiracion celular
respiracion celularrespiracion celular
respiracion celular
jent46
 
control de actividades celulares
control de actividades celularescontrol de actividades celulares
control de actividades celulares
jent46
 
quimica celular
quimica celularquimica celular
quimica celular
jent46
 
estructura y funcioin celular
estructura y funcioin celularestructura y funcioin celular
estructura y funcioin celular
jent46
 
Que Es La Vida
Que Es La VidaQue Es La Vida
Que Es La Vida
jent46
 

Más de jent46 (10)

relacion de las matematicas con la biologia y la quimica
relacion de las matematicas con la biologia y la quimicarelacion de las matematicas con la biologia y la quimica
relacion de las matematicas con la biologia y la quimica
 
Interaccion en java
Interaccion en javaInteraccion en java
Interaccion en java
 
Clasifseresvivos
ClasifseresvivosClasifseresvivos
Clasifseresvivos
 
Mitosis y Meiosis
Mitosis y MeiosisMitosis y Meiosis
Mitosis y Meiosis
 
fotosintesis
fotosintesisfotosintesis
fotosintesis
 
respiracion celular
respiracion celularrespiracion celular
respiracion celular
 
control de actividades celulares
control de actividades celularescontrol de actividades celulares
control de actividades celulares
 
quimica celular
quimica celularquimica celular
quimica celular
 
estructura y funcioin celular
estructura y funcioin celularestructura y funcioin celular
estructura y funcioin celular
 
Que Es La Vida
Que Es La VidaQue Es La Vida
Que Es La Vida
 

java

  • 1.
  • 2. Objects everywhere... Real world entities
  • 3.
  • 4.
  • 5. Objects have identity... Our house The neighbour’s cat Hasan’s computer Merhababen Ayse My book Dombo the elephant
  • 6. Objects have state... Red Lying Happy Hooked ill Broken
  • 7. Objects have behavior…. Grrrrrrrr Vroemm Hello, I am John Nice to meet you da da …
  • 8.
  • 9.
  • 10. Objects and Classes Bank Account A class (the concept) John’s Bank Account Balance: $5,257 An object (the realization) Bill’s Bank Account Balance: $1,245,069 Mary’s Bank Account Balance: $16,833 Multiple objects from the same class
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. Object-Oriented Model methods data Object boundary
  • 17. Example: Pencil location direction penDown home up down write
  • 18.
  • 19.
  • 21.
  • 22. Class Car Car color speed power drive turn right turn left stop attributes operations class name
  • 23. in Java Car String color int speed int power drive() turnRight() turnLeft() stop() attributes or instance variables methods class name
  • 24.
  • 25. Class Pencil Pencil int location String direction home() up() down() write() attributes methods Name
  • 26.
  • 27.
  • 28.
  • 29.
  • 30. Declaring Objects Class Person ayse; Person String name String birthDate int age getName() getAge … . ayse is of Class
  • 31.
  • 32. Declaring and Creating Objects Class karanfil = new Flower(); Flower karanfil; Flower int age int length int weight getAge() getLength() … . Object instance of refers to karanfil is of Class
  • 33.
  • 34.
  • 35. Example ayse Class Object instance of refers to is of Class ayse = new Person(); Person ayse; ayse.setName( “Ayse Engin“) ; ayse.setAge(24); Person String name String birthDate int age setName(String name) setAge(int age) getName() … . Ayse Engin 24