java oop

7
Basic Java Object-Oriented Programming Concepts Prepared By: Din Islam data source: https://docs.oracle.com/javase/tutorial/java/concepts/index.html

Upload: din-islam

Post on 19-Jan-2017

30 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Java OOP

Basic

Java Object-Oriented Programming Concepts

Prepared By:Din Islamdata source:https://docs.oracle.com/javase/tutorial/java/concepts/index.html

Page 2: Java OOP

Java Object-Oriented Programming Concepts

1. Object 2. Class3. Inheritance4. Interface5. Package

Page 3: Java OOP

Object

1. State and behaviorBenefit:• Modularity• Information-hiding• Code re-use• Pluggability and debugging ease• Hiding internal state and requiring all interaction to be performed through an

object's methods is known as data encapsulation

Page 4: Java OOP

Class

A class is the blueprint from which individual objects are created

Example:we say that your bicycle is an instance of the class of objects known as bicycles.

Page 5: Java OOP

Inheritance

class is allowed to have one direct superclass, and each superclass has the potential for an

unlimited number of subclasses

ExplainObject-oriented programming allows classes to inherit commonly used state and

behavior from other classes

Page 6: Java OOP

Interface

Interfaces form a contract between the class and the outside world, and this contract is enforced at

build time by the compiler

BenefitImplementing an interface allows a class to become more formal about the

behavior it promises to provide

Page 7: Java OOP

Package

A package is a namespace that organises a set of related classes and interfaces