Java Learning (ii) objects and classes

Source: Internet
Author: User

Here, you think of yourself as God.

1. Objects

You want to show your friends a graph, if you create a rotating square, a circle, and a triangle, he wants to see which graph you will show him which graph, is object-oriented;

If you create a deformed shape, he will look at the internal series of judgments (because the graphics are many, so the inside will be very complex, and will affect each other) into what he wants to see is the process-oriented.

2. What is the difference between a class and an object?

You're still a god.

You think about what a dog looks like. OK, this is the class, in the program is the Dog.java file (this is just a dog's drawings)

All right, you take the mud, you pinch a puppy as you think, and you live, and that's the object of a puppy. New Dog () is the process you pinch, and the new one gives you a puppy (instantiating a dog object)

Java Learning (ii) objects and classes

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.