Packaging
Actually use methods to hide the data of a class and control the user's permission to modify and access the class.
Encapsulation is an information hiding technology that is encapsulated in Java through the keyword private .
Inherited
Using existing classes as the basis for building new classes, the definition of new classes can add new data or new functionality, or use the functionality of the parent class, making it easy to reuse the original code and greatly shorten the development cycle.
public class Animal {private int: age; String sex= "Femaleanimal"; protected void Sleep () { System.out.println ("I can Sleep"); } Public Animal () { System.out.println ("This Is super Class (Fulei)"); } void Eat () { System.out.println ("I can Eat"); } void Call () { System.out.println ("--------------"); } } Class Dog extends animal{public Dog () {}void call () {//TODO auto-generated Method Stub System.out.println ("------- -wangwang------");}} Class Cat extends animal{ void call () { System.out.println ("-----miaomiao---------");}}
Polymorphic
Multiple word classes inherit common parent classes, defining references that use the same parent class to point to different child class objects
Coercion type conversion with instanceof keyword
Instance of means that an object is an instance of a class.
Three characteristics of object-oriented