Three characteristics of java object-oriented

Three characteristics of java object-oriented: "encapsulation, inheritance and polymorphism". For more Java technology knowledge, please log in to the crazy software education official website. Wechat search wechat: Crazy software, participate in 2015 preferential activities, and have the opportunity to get preferential pain relief

Taking this article as an example, the variables in the user class are private variables, which can only be assigned by creating an object (the constructor is called automatically at this time).

The user class can only be accessed by the public method API ().

The admin class inherits the user class, calls its constructor, and overrides the method_ 1 method, a special method power () is added.

User file

The above is the whole content of this article. I hope you can like it.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>