Object-oriented Java

Source: Internet
Author: User

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

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.