Java was born in 1995. Formerly Oak, later renamed Java.
Object-Oriented Programming idea: object is everything.
An object is made up of two parts: Properties and Methods
1: Property is the static property (noun) of an object
2: Method is the dynamic nature of the object (verb)
Like what:
A person's attributes are: Name, weight, height, gender, appearance, age, character.
A person's way is: eat and drink, sleep, run, talk, fight, play games.
Like what:
Properties of a car: horsepower, fuel consumption, color, brand, displacement, price, maximum turn, tank capacity, number of passengers.
The way to a car: forward, reverse, drift, turn.
Like what:
Attributes of ants: variety, color, size, weight
Ant's Method: Eat, bite, move, on the tree.
Think: Which object has no attributes, or is there no method? No! So everything has properties and methods, so everything is an object!
Thinking: Between different objects, there is only no same attribute, or the same method?
What are the same attributes between elephants and Superman?
Weight, gender, age, height, color
Elephant and Superman, what is the same way?
Eat, drink, pull, sprinkle, sleep, fight, walk, run between everything, between any two objects, must have the same properties and methods.
Think: What do you get when you combine objects with exactly the same attributes and exactly the same method? Class!
The classification is based on abstraction, which is the omission of specific attribute values, as long as the attributes. Ignore the process of action, as long as the action.
The following is an abstract person, to materialize, attribute all assigned value, this process is called instantiation.
person P1 = new person ();
P1.name = "Spider-Man"
p1.sex= ' Women ';
p1.age=12;
Yue for (Shenzhen) technology Co., Ltd.
Enjoy the fun
: Joyvisyojoy
Weibo: Http://weibo.com/JoyVis
Official website:http://www.yuevis.com/
Contact & submission:[email protected]
Object-oriented Java