Presentation is loading. Please wait.

Presentation is loading. Please wait.

OBJECT ORIENTED PROGRAMMING

Similar presentations


Presentation on theme: "OBJECT ORIENTED PROGRAMMING"— Presentation transcript:

1 OBJECT ORIENTED PROGRAMMING
start() OBJECT ORIENTED PROGRAMMING 1 JAVA

2 Outlines OOP Java Class Object Method Variable Access Modifier
2 OOP Java Class Object Method Variable Access Modifier Static Clause Example

3 What Is? 2 OOP is programming language based on object.

4 What Is Non Object? Name1 Name2 Color1 Color2 Age1 Age2
3 Name1 Name2 Color1 Color2 Age1 Age2 Weight1 Weight2

5 What Is Object? Object1 name Object2 Name Color Color Age Age
4 Object1 name Object2 Name Color Color Age Age Weight Weight

6 main() JAVA 5

7 What is? 6 Java is one of Object Oriented Programming specifically designed to have as few dependencies as possible Developed by James Gosling at Sun Microsystem 1995

8 About Java Object oriented Class based Most popular in 2016
7 Object oriented Class based Most popular in 2016 Run under Java Virtual Machine (JVM) Run on billions machine Acquired by Oracle

9 Java Elements 8 Class Object Method Variable

10 What Is Class? A blue print of all instruction of the program.
9 A blue print of all instruction of the program. It is a file anyway

11 About Class File name must match the class name
10 File name must match the class name .java is the file extension & .class is transformed extension after compiling Can initiate object Can be accessed from other class

12 What Is Object? 11 An instance of a class. Once created it has all behavior of the class. Just like a child of a parent

13 About Object 12 It inherits all method and variable of its class. Except the static one(s) (will learn later) Can be created by other class Class data independent

14 What Is Method? 13 A behavior (instruction) of the class or object.

15 About Method Mostly used to set or get a value
14 Mostly used to set or get a value It has access modifier (learn later)

16 What Is Variable? 15 A location to store data on memory.

17 About Variable Each variable reserves a location in the memory
16 Each variable reserves a location in the memory In java, unused variable will be thrown to trash It has access modifier (learn later)

18 Access Modifier Public :transparent to all class
17 Public :transparent to all class Private :transparent to its class Protected :transparent to its package

19 Static Clause Static clause is used by variable and method.
18 Static clause is used by variable and method. variable that stated as static will always refer to class or parent variable. And so will method.

20 Illustration Color Brown Get Name Change Name Get Age Change Age
19 Color Brown Get Name Change Name Get Age Change Age Get Parent Color Change Parent Color Jude 5 Y.O Parent color John 4 Y.O Parent color Jack 2 Y.O Parent color

21 Example 20 public class Dog{ String name int age public Dog(){}
public string getName(){ return name; } public void setName(String newName){ name = newName; } public int getAge(){ return age; } public void setAge(int newAge){ age = newAge; } //Happy coding… } public class Display{ @Override public void onCreat(){ createObject(); } private createObject(){ Dog dog = new Dog(); dog.setName(“Jack”); dog.setAge(“3”) //Happy coding… 20

22 continueToNextPPT() Thank You 21


Download ppt "OBJECT ORIENTED PROGRAMMING"

Similar presentations


Ads by Google