Student Class Student:
Cloning clone clone package;
/* To clone must implement this excuse: cloneable, to mark this object can be cloned
cloneable: This class implements the Cloneable interface to indicate that the Object.clone () method
definition: saves a state of an object so that it can be recovered at the appropriate time
Characteristics:
1, to provide users with a mechanism to restore the state, you can make it easier for users to return to a certain historical state.
2,
1, the establishment of exception package, writing Testexception.java program, the main method has the following code, to determine the possible exceptions, for capture processing.
public class Yichang {public
static void Main (string[] args)
One, what is the reflection mechanismIn simple terms, the reflection mechanism refers to the ability of a program to obtain its own information at run time. In Java, given the name of a class, all the information about the class can be obtained
The difference between Thread.Start () and Thread.run ()
Start a thread by invoking the start () method of the thread class, at which point the thread is in a ready state and is not running. This thread class then invokes method run () to complete
Analysis of Java serialization algorithm
Serialization (serialization) is a process of describing an object in a sequence of bytes; Deserialization deserialization is the process of resetting these bytes into an object. The Java Serialization API
A class that implements the Runnable interface must use an instance of the thread class to create a thread. Creating threads through the Runnable interface is divided into two steps:
1. Instantiate the class that implements the Runnable interface.
In the "in-depth analysis of Java internals" You can learn something about the Java inner class, but there are some places in the inner class that deserve our careful study ...
Here are some of the things that I've summed up in the Java inner class
I. Comparison with static methods
In general, if some code has to be executed at the time the project is started, you need to use static code blocks, which are active, need to be initialized at the time the project is started, and when other
1, belong to Javax.swing package.
2, Function: Customize four different kinds of standard dialog box.
Confirmdialog Confirmation dialog box. Ask the question and then confirm by the user (press "Yes" or "No" button)
Inputdialog Prompt to enter
When two processes are communicating remotely, they can send different types of data. Regardless of the type of data, it is transmitted over the network in the form of a binary sequence. The sender needs to convert the Java object into a byte
The build process of the inheriting class is spread outward, the subclass is initialized, and the parent class must also initialize the
Copy Code code as follows:
Class art{
Art () {
System.out.println ("Art");
}
}
Class Drawing
Think the author is too good to write, have to collect.
The understanding of this example:
Type parameters cannot be of basic type, T and u are actually the same type.
Each time the new data is the new top, the original top down the level,
Remove spaces in Java
1. String.Trim ()
Trim () is to remove the trailing space
2.str.replace ("", ""); Remove all spaces, including end to end, middle
Copy Code code as follows:
String str = "Hell o";
String str2 = Str.replaceall ("
Java tips and best practices for avoiding nullponintexception in Java applications
In a Java application, a nullponintexception (null-pointer exception) is the best way to solve (a problem). At the same time, null pointers are key to writing robust,
Mode one:
Double F = 3.1516;BigDecimal B = new BigDecimal (f);Double f1 = B.setscale (2, bigdecimal.round_half_up). Doublevalue ();
Mode two:
New Java.text.DecimalFormat ("#.00"). Format (3.1415926);#.00 represents a two-bit decimal #.0000
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