You are on page 1of 3

Core concepts of oopj

The main Concepts are:

 Object
 Class
 Abstraction
 Inheritance
 Polymorphism
 Encapsulation
 Modularity

Object

An object is a well-defined entity with a distinct identity and boundaries that incorporates state and
activity.

-Attributes and relationships represent state. A state is a circumstance that an object finds itself in at
any given time that performs an action, waits for an occurrence, or satisfies a condition.

-Operations, techniques, and state machines are used to express behavior. An object's behavior
determines how it behaves and responds.

A rectangle with the name of the object underlined is used to represent it.

Class

A class is a description of a group of objects that have similar semantics, relationships, operations,
and attributes. Three compartments in a rectangle are used to represent a class.

Abstraction

the fundamental traits that set an entity apart from all other types of entities. used to hide some
information and display just key aspects of the objects. defines a boundary in relation to the
observer's viewpoint.

Encapsulation

a means of combining the code acting on the data (methods) and the data (variables) as a single
unit.

Polymorphism

The capacity of an object to assume various forms is known as polymorphism.

Inheritance

a process by which one object takes on all the traits and characteristics of a parent object. There are
3 types of inheritance:

– single inheritance
– multiple inheritance

– multi-level inheritance

Modularity

divides a difficult object into manageable pieces. facilitates understanding of complex systems.

abstract class Figure {

abstract int area();

abstract int perimeter(); //Abstraction

class Calculate extends Figure //Modularity

private int length; // Encapsulation

private int width;

public Calculate(int length, int width)

this.length=length;

this.width=width;

@Override public String toString()

return "Area of the figure is: " +area()

+ " and Perimeter is: "+perimeter() ;

}
@Override int area() { return length * width;};

@Override int perimeter() { return 2*(length+width);};

public class Find {

public static void main(String[] args)

Figure f1= new Calculate(9,3); //Abstraction

System.out.println(f1.toString());

You might also like