Java Learning Notes--hiding implementation

Source: Internet
Author: User
Note hiding the implementation
This sentence is very good:
In any relationship, it's important to have boundaries this are respected by all parties.
No matter what your relationship is, it's important to have a line of mutual respect.

#----
CLASSPATH (to capitalize, preferably plus current directory.):
The Java interpreter looks for the. class file in the following two places:
1. Standard directory for JDK
2. Path = package (such as: NET/\LIBK) after the midpoint of classpath (such as: NET.LIBK)

#----
Public > protected (∵ contains package permissions) > Package > Private

#----
Package NET.LIBK; This means that the current class is under CLASSPATH/NET/LIBK

#----
Singleton pattern: Only one instance/object of the class can be created.

The constructor is defined as private so that the client programmer cannot create an object and then define a private static member variable to point to an instance of the class.
Then create a public static method to return to this private static field.
Such as:
Class Singleton {
Private Singleton () {};
private static Instance = new Singleton ();

Pubic static Singleton access () {
return instance;
}
}

#----
If the import comes in the class library with duplicate names conflict, use the full name to resolve the conflict
Java.util.Vector v = new Java.util.Vector ();


#----
Compiling unit:
A. Java source file. Compiling unit can have all classes, but at most only one public class, if there is public class,
The filename must be the same as the class name, and the other class becomes the auxiliary class for this public class.

#----
The access specifier class has only two types of public and package. (Except inner Class)




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.