Think in Java

Source: Internet
Author: User
Java also has a "default" access, which comes into play if you don't use one of the aforementioned specifiers. this is usually called package access because classes can access the members of other classes in the same package (library component), but outside of the package those same Members appear to be private. the "wrapper" classes for the primitive data types allow you to make a non-primitive object on the heap to represent that primitive type.

Java. Lang is implicitly encoded in every Java code file

Constructor may call other construcotr via this internally, but cannot use this to call constructorfinalize () in member functions. When will it be called? There are three cases: 1. All objects are automatically called when they are garbage collection, such as when system. GC () is run. 2. Program The Finalize method is called once for each object upon exit. 3. explicitly call the Finalize method. Normally, when an object is collected as useless information by the system, finalize () is automatically called, but the JVM does not guarantee finalize () it must be called. That is to say, the call to finalize () is uncertain. That is why Sun does not advocate the use of finalize () because they are in the same directory and have no explicit package name. java treats files like this as implicitly part of the "Default package" for that directory, and thus they provide package access to all the other files in that directory. protected also gives package access-that is, other classes in the same package may access protected elementsthe actual process of initialization is: 1.The storage allocated for the object is initialized to binary zero before anything else happens.2.the base-class constructors are called as described previusly. at this point, the overridden draw () method is called (yes, before the roundglyph constructor is called), which discovers a radius value of zero, due to step 1.3.member initializers are called in the order of declaration.4.the body of the derived-class constructor is called.

 

@ Override

When you mean to override a method, you can choose to add this annotation and the compiler will produce an error message if you accidentally overload instead of overriding

 

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.