91. Package name: lowercase letters, domain names in reverse order.
92. The class in the package must be declared as public. Otherwise, the method that does not belong to this package cannot use it.
93. Use a JAR file for easy maintenance and installation. a jar file usually contains multiple packages. The standard classes provided by Sun J2SE are placed in rt. jar.
.
94. J2SE provides tool software jar to generate JAR files:
Jar cvf <jar file> <class file>
Jar cmvf <manifest> <jar file> <class file> use m to include a custom description (manifest) file
Manifest. mf.
95. Enter the created package in: import com. mycompany. shape. *; non-import com. mycompany. shp;
This JAR file is included in the class path. In Windows, you need to SET: set classpath =.; shapr. jar. Or you can use: java
-Classpath <class path> <class file>
96. Because the variables related to the object belong to the reference type, use obj1 = obj2; obj1 only obtains a copy of the obj2 application, instead
The obj2 object itself.
97. Use clone () to copy an Object. clone () inherits from the Object class. Obj1 = obj2.clone (); obj2 must be replicable
.
98. To make a custom class object reproducible, you must use the interface Cloneable and declare a public method clone ()
To perform replication.
99. To complete deep copy (including the referenced object and its related objects), you must follow the hierarchical relationship between objects.
Copy them one by one.
100. Reflection is also called introspection because it allows Java programs in execution to perform self-check and get an object
It is a unique function of Java.
101. Reflection improves functions like function pointers, and dynamically improves the class object method name and
The parameter to be entered.
102 first, get a Class object. There are two methods:
Use getClass () to obtain a class object from the existing class object, such as obj. getClass ();
Use Class. forName (String className)
103. Second, use the method provided by the Class to obtain relevant data of the Class.
String getName (); used to obtain the name of the class
Method [] getDeclaredMethods (); obtain the names of all methods declared in this class.
Method [] getMethods (); obtain all Method names in the class, including methods inherited by the parent class
Method getMethod (String methodName, Class [] parameterTypes); get a Method object
104. Finally, use the Method provided to execute the Method to be executed
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