0% found this document useful (0 votes)
190 views1 page

Polymorphism Method Overloading and Method Overriding.: Vehicle String Colour String Model

Abstraction defines real-world objects as classes with common properties, like defining a Vehicle class with color and model properties. Encapsulation combines class methods and attributes into containers that expose only public methods, hiding implementation details. Polymorphism allows method overloading and overriding. Static members are allocated once in memory and shared across instances, while instance members are allocated for each object and accessed via object references. Abstract classes define abstract methods for child classes to implement, while interfaces contain only abstract methods that classes must implement.

Uploaded by

Manish Shankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
190 views1 page

Polymorphism Method Overloading and Method Overriding.: Vehicle String Colour String Model

Abstraction defines real-world objects as classes with common properties, like defining a Vehicle class with color and model properties. Encapsulation combines class methods and attributes into containers that expose only public methods, hiding implementation details. Polymorphism allows method overloading and overriding. Static members are allocated once in memory and shared across instances, while instance members are allocated for each object and accessed via object references. Abstract classes define abstract methods for child classes to implement, while interfaces contain only abstract methods that classes must implement.

Uploaded by

Manish Shankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

What is an abstraction?

Abstraction is a way of converting real world objects in terms of class. It’s a concept of defining
an idea in terms of classes or interface. For example creating a class Vehicle and injecting
properties into it.

public class Vehicle {


public String colour;
public String model;
}

What is Encapsulation?

The encapsulation is achieved by combining the methods and attribute into a class. The class
acts like a container encapsulating the properties. The users are exposed mainly public methods.
The idea behind is to hide how things work and just exposing the requests a user can do.

Polymorphism

Method Overloading and Method Overriding.

Static & Instance

Static: Memory is allocated only once in the program. Common for every object - there memory
location can be sharable by every object reference or same class. Static variable can be accessed
with class reference.

Instance: Memory is allocated whenever a new object is created. Specific to an object. Can be
accessed with object reference.

Abstract Class & Interface.


Abstract Classes can't be instantiated. Need to create Abstract class to create abstract Methods.
Abstract Methods can be implemented by Redefinition in child classes.

Interfaces are 100% Abstract. Methods of Interface can be implemented by Classes only.

You might also like