OBJECT ORIENTED PROGRAMMING

Slides:



Advertisements
Similar presentations
In Review JAVA C++ GUIs - Windows Webopedia.com.
Advertisements

Exceptions Session 21. Memory Upload Creating Exceptions Using exceptions to control object creation and validation.
INHERITANCE BASICS Reusability is achieved by INHERITANCE
 In inheritance the child (subclass) chooses its parent (superclass)  Remember - only public or “protected” methods and variables are inherited  Should.
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
CSCI 143 OOP – Inheritance 1. What is Inheritance? A form of software reuse Create a new class from an existing class – Absorb existing class data and.
Slide 1 of 40. Lecture A The Java Programming Language Invented 1995 by James Gosling at Sun Microsystems. Based on previous languages: C, C++, Objective-C,
CS102--Object Oriented Programming Review 1: Chapter 1 – Chapter 7 Copyright © 2008 Xiaoyan Li.
Introduction to Java.
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
(C) 2010 Pearson Education, Inc. All rights reserved.  Java programs normally go through five phases  edit  compile  load  verify  execute.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package.
Lecture :2 1.  DEFENTION : Java is a programming language expressly designed for use in the distributed environment of the Internet. It was designed.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
Sun Certified Java Programmer, ©2004 Gary Lance, Chapter 5, page 1 Sun Certified Java 1.4 Programmer Chapter 5 Notes Gary Lance
Object-Oriented Programming. An object is anything that can be represented by data in a computer’s memory and manipulated by a computer program.
1 CSC/ECE 517 Fall 2010 Lec. 3 Overview of Eclipse Lectures Lecture 2 “Lecture 0” Lecture 3 1.Overview 2.Installing and Running 3.Building and Running.
1 The JAVA Language Object Oriented Technology Mithani Binjan M.
Developed at Sun Microsystems in 1991 James Gosling, initially named “OAK” Formally announced java in 1995 Object oriented and cant write procedural.
Access Modifiers Control which classes use a feature Only class-level variables may be controlled by access modifiers Modifiers 1. public 2. protected.
Today… “Hello World” ritual. Brief History of Java & How Java Works. Introduction to Java class structure. But first, next slide shows Java is No. 1 programming.
Java FilesOops - Mistake Java lingoSyntax
JAVA Ekapap Julnonyang When it was implemented? Developed by Sun Microsystems. The first public implementation was Java 1.0 in 1995 The language.
Introduction to Java John Lewis. Course Overview Introduction Object Orientated Programming Java Structure and Syntax Using the Java Platform Advanced.
Classes, Interfaces and Packages
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
CSH Intro. to Java. The Big Ideas in Computer Science Beyond programming Solving tough problems Creating extensible solutions Teams of “Computational.
BY:- TOPS Technologies
JAVA TRAINING IN NOIDA. JAVA Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically.
Chapter 1 Object Orientation: Objects and Classes.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Introduction to java (class and object). Programming languages: –Easier to understand than CPU instructions –Needs to be translated for the CPU to understand.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Introduction to Object Oriented
Inheritance Chapter 7 Inheritance Basics Programming with Inheritance
Java Interview Questions
Module Road Map Refactoring Why Refactoring? Examples
University of Central Florida COP 3330 Object Oriented Programming
GC101 Introduction to computer and program
Objects as a programming concept
Chapter 1 Introduction to Computers, Programs, and Java
Interfaces.
Java Primer 1: Types, Classes and Operators
The Java Programming Language
Internet and Java Foundations, Programming and Practice
Abstract Class, Interface, Package
University of Central Florida COP 3330 Object Oriented Programming
ATS Application Programming: Java Programming
ATS Application Programming: Java Programming
Introduction to Java.
Interface.
An Introduction to Java – Part II
Java Programming Language
Object-Oriented Programming
Units with – James tedder
Units with – James tedder
Inheritance Inheritance is a fundamental Object Oriented concept
Class Everything if Java is in a class. The class has a constructor that creates the object. public class ClassName private Field data (instance variables)
Programs and Classes A program is made up from classes
Session 2: Introduction to Object Oriented Programming
(Computer fundamental Lab)
Object-Oriented Programming
Announcements Assignment 4 Due Today Lab 8 Due Wednesday
Presentation transcript:

OBJECT ORIENTED PROGRAMMING start() OBJECT ORIENTED PROGRAMMING 1 JAVA

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

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

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

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

main() JAVA 5

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

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

Java Elements 8 Class Object Method Variable

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

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

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

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

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

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)

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

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)

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

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.

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

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

continueToNextPPT() Thank You 21