Understanding Java-Object-oriented-properties, methods

Source: Internet
Author: User

Understanding Java-Object-oriented-properties, methods

The manifestation of polymorphism:
Upward styling, the parent class receives the sub-class object;
Upward styling:
A method that is unique to a subclass is not visible from the parent class perspective;

Object-oriented, human cognitive way of the world;
Every day in life is polymorphic:
This person is who, this is a person, polymorphism to see him;
He is the teacher to look down on it, he is a teacher, know that he can lecture, the teacher is the sub-type of people below;


Every day we have many states to receive things, and then look down:
This is a person, this person is a teacher;
This is the car, this car is Audi.


When I was a child, I did not know what it was, and asked what it was, everything in the world could become something, something that Object,object was a refined translation into an object,
Java Everything object = = Java All things
Object-oriented Language = = Orient to things language

Everything is Object,java. Everything is received with object;
When you don't know what it is, take it as object, as object.


Class of:
Properties, Methods
Equals
In real life:
characteristic, behavior;

Human feature = = Property:
Name, gender, height, everyone has, the value is not the same, but Baldy has no hair, there is hair, but the value is null, can not say that he has no hair

Human Behavior = = Method:
Will go, will run, will jump, run the same way, the algorithm is the same as the left and right legs run, with parameters, Yao Ming ran a block

The properties and methods of the parent class, all subclasses have, the generality is few, the object method is few, the object adds a method, all subclasses have;

Everything's going to be all right, things can run? Something is a concrete example, so you can't say anything will run.

Data privatization, behavior openness,


Wallet private, only I can use, want to spend my money, and I want to borrow,
I can decide to lend you or not to lend you;

Although I can change my data, I still have the right to decide.


An attribute that is not known to be private, and is set to private for the sake of conservatism;

Understanding Java-Object-oriented-properties, methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.