OOPS Training Concepts
OOPS Training Concepts
Class It should start with the uppercase letter. public class Employee
It should be a noun such as Color, Button, {
System, Thread, etc. //code snippet
Use appropriate words, instead of }
acronyms.
Look at the following illustration to see the difference between class and
objects:
EX: 1
Class Objects
Fruit Apple
Banana
Mango
EX: 2
Class Objects
Car Volvo
Audi
Toyota
OBJECT
An object is a basic unit of Object-Oriented Programming that
represents real-life entities. A typical Java program creates many
objects, which as you know, interact by invoking methods. The objects
are what perform your code, they are the part of your code visible to
the viewer/user.
Object Definitions:
Output
Inheritance
When one object acquires all the properties and behaviours of a parent
object, it is known as inheritance. It provides code reusability. It is used
to achieve runtime polymorphism.
Abstraction
Hiding internal details and showing functionality is known as abstraction.
Encapsulation
Binding (or wrapping) code and data together into a single unit are
known as encapsulation. For example, a capsule, it is wrapped with
different medicines.