Professional Documents
Culture Documents
Opp's
Opp's
1.Encapsulation: Java allows you to use access modifiers (such as private, protected, and
public) to control the visibility of class members (fields and methods). This allows you to
hide the internal state of an object and expose only a public interface for interacting with it.
2.Inheritance: Java allows classes to inherit properties and behavior from a parent class
using the "extends" keyword. This allows for code reuse and reduces duplication.
3.Polymorphism: Java allows objects to respond to the same method call in different ways,
depending on their type. This can be achieved through method overloading (having multiple
methods with the same name but different parameters) and method overriding (having a
method in a derived class with the same name and parameters as a method in its parent
class).
4.Abstraction: Java provides the "abstract" keyword to define an abstract class, which
cannot be instantiated but can be used as a base class for other classes. Abstract classes can
contain abstract methods, which are methods without a body that must be implemented by
derived classes.
5.Classes: Java uses classes as a blueprint for creating objects, which define their properties
and behavior.
6.Objects: Java uses the "new" keyword to create instances of a class, which are called
objects. Objects can have fields (variables that hold data) and methods (functions that
perform actions).
7.Methods: Java uses methods to define the behavior of a class or object. Methods have a
name, a return type, and a list of parameters.
8.Interfaces: Java uses interfaces to define a contract for a class, specifying a set of methods
that a class must implement in order to be considered an implementation of that interface.
10.Overloading: Java allows to use multiple methods with the same name but different
parameters in a class.