Answer:
1. Encapsulation
- Encapsulation is a mechanism by which developer could hide implementation behind an interface.
- Encapsulated code has two features:
- Instance variables are kept protected (usually with the private modifier).
- Getter and setter methods provide access to instance variables.
- Kindly take a look at tutorial: Complete End to End working Encapsulation example
- The public setName() and getName() methods are the access points of the instance variables.
2. Inheritance
- Inheritance allows a class to be a subclass of a superclass, and thereby inherit public and protected variables and methods of the superclass.
- Inheritance is a key concept that underlies polymorphism, overriding, overloading and casting.
3. Polymorphism
- Polymorphism means “many forms.”
- A reference variable is always of a single, unchangeable type, but it can refer to a subtype object.
- A single object can be referred to by reference variables of many different types —as long as they are the same type or a supertype of the object.
- Polymorphic method invocations apply only to overridden instance methods.
If you want to explore more, visit our Java edu & tutorials section! Below are some examples:
You can also follow some of the broadcasters who program in Java, like the ones below:
Another cool way to find out interesting things about Java is to access our project page!