Chapter 20. Java: The concept of the object (free delivery target)

Java singles seeking a partner group
     Wang: I heard someone sent an object, is it really?
    Xiaogang: Really?
    Rain: There are such a good thing? I do not believe
    black Marshal: Yes, you heard it right, see this blog, free delivery Marshal objects.
    Flowers: coming, coming, wait for me, I'm missing objects
    in java programming world, objects everywhere. What is the object? Here simple to elaborate:
    Object: the real world that everything is seen as an object. Each object includes attributes and methods applied to the attribute, by interacting messages between objects.
    Supplement:
    1. Class: class having the same operating functions (methods) and the same data object format (attributes) and a set of abstract;
    difference between the object and class 2: class is abstract object, the object is a specific instance of the class . Class is abstract and does not take up memory space, and the object is concrete and memory footprint. For example: class is vegetables, and the object is potatoes.
    How to create objects?
    Object class name name = new class name (); translated into code:
King king =new King();

    Analysis: King is the class where the class name, king out for the new object, case-sensitive, and here I would like to say is:
    this is not a new instance of the object out of the object itself, but rather a reference to the object, the equivalent of a reference address, you can find examples of the object itself through it. Among reference object on the stack, and examples of the object itself which exists in the heap, so when someone asks which one is the object, you have to know someone to ask questions.
Here Insert Picture Description

Have questions please leave a message!

Like a point, plus followers chant! Hey!

Published 38 original articles · won praise 91 · views 10000 +

Guess you like

Origin blog.csdn.net/H_W_1212/article/details/104105620
Recommended