Features of Java
There are main four features of Java Programming Language:
There are other features like:
- Method Overloading
- Method Overriding
Using the abstraction feature of Java, we can protect certain data and show only necessary information to the user. In Java, abstraction can be achieved using either abstract classes or interfaces.
An abstract class in java is a restricted class that cannot be used to create an object. To access an abstract class you will need to inherit it from another class.
An abstract method in java is only used inside an abstract class and it does not have a body. The body is provided by the subclass that inherits that abstract class.
Polymorphism means many forms and this feature is used when we have many classes and these are related to each other by using the inheritance feature.
The inheritance feature of Java is used to inherit attributes and methods from one class to another. The class that inherits attributes and methods from another class is called a child class or subclass. And which class’s attributes and methods are inherited is called parent class or superclass.
Encapsulation in Java is a feature that is used to wrap the data and code in a single unit (just like a capsule that contains a mix of particular medicines).