Read about core java volume ii advanced features, The latest news, videos, and discussion topics about core java volume ii advanced features from alibabacloud.com
Java Core Technology Volume One
Java base type
Integral type
Data Type
Number of bytes
range of Values
Int
4
+_2^4*8-1
Short
2
+_2^2*8-1
Long
8
+_2^8*8-1
Byte
1
For this code, a lot of netizens are full of questions, first there are many, not careful, did not write the pair class, to compile.Certainly compiled, the pair class is on the first two pages of the other code.And here, the features of generics are written. By several constructors, and the change of parameters, the generic type is explained.Package pair1;public class pairPrivate T first;Private T second;Public Pair () {first = null;second = null;}Pub
class does not have a way to modify the strings, if you really want to change them
The following expressions are legal
The = = operator detects whether two strings are placed in the same position
In fact, only string constants are shared, and the results of operations such as + or substring are not shared
Issupplementarycodepoint (int codepoint) is a Boolean method of the character class that determines whether the specified character (Unicode code point) i
Interneta Short history of Javacommon misconceptions about JAVACHAPTE R 2 the Java Programming Environment (new comments Total 20) Chapter 3 fundamental programming structures in Java (new comments Total 44) Chapter 4 Obje CTS and Classes (new comments Total 55) Chapter 5 Inheritance (new comments Total 42) Chapter 6 Interfaces and Inner Classes (new comments Total 24) Chapter 7 Excepti ONS, Logging, asser
-code unit S u+d835 and u+dd6b. (see http://en.wikipedia.org/wiki/UTF-16 for a description of the encoding algorithm.) in Java, the char type describes a code unit in the UTF-16 encoding.Our strong recommendation isn't to use the char type in your programs unless you are actually manipulating UTF-16 cod E units. You is almost always better off treating strings as abstract data types.3.3.4. The Boolean Type The Boolean type has two values, false and Tr
Tag: Util indicates date () Date class specifies date standard int ringIn the Java core Technology volume, the first date class appears in a very high frequency, so we have a small integration of the date classThe date class has twoThe date class represents a specific time classThis constructor assigns a Date object and initializes it to represent the specified n
Lambda An expressionform: parameter, arrow (-), expressionParameter type to write, if you can deduce it can not writeOnly one argument can omit parenthesesNo arguments to write empty brackets ()* If the branch returns a value, then all branches will return a value, otherwise it is illegalfunction interface: interface with only one abstract method (can be marked with @functionalinterface annotations)For example, you can do this in Javax.swing.Timer. Timer T = new timer (+, event-{...});The s
schematic, the inside of the compiler is certainly not outer An implicit reference to an external class is set in the constructor. The compiler modifies all constructors for the inner class, adding a parameter that references the external class. Even if you do not define a constructor for an inner class, the compiler generates a default constructor for the inner class. such as:Publictimeprinter (talkingclock clock) {outer = clock;}When an inner class object is created in the Start method, th
Basic data typesJava is the language of a strong data classThere are 8 basic data types, including:Integer 4 types Int (4 bytes) short (2 bytes) long (8 bytes) byte (1 bytes)The range and machine-independent lengths of integers in Java are certain, and do not cause integer overflow across platformsFloat type two double floatThe length of the double is twice times the length of the float, the double value but the part is used double, at the time of pre
interrupted by Interruptedexcetpion"); Thread.CurrentThread (). interrupt (); //The interrupt state is cleared when the interruptedexception exception is generated, all the interrupts are reset or thrown out for subsequent code to detect if an interrupt has occurred } if(thread.currentthread (). isinterrupted ()) System. out. println ("Sub thread is interrupted"); ElseSystem. out. println ("Sub Natural Stop"); } }; Thread T=NewThrea
List 13.1 Linklist/linkedlisttest.javaLinklist of Java ContainersPackage Linklist;import Java.util.linkedlist;import Java.util.list;import Java.util.listiterator;public class Linklisttest{public static void Main (String args[]) {list Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. Java Core Technology
box containing a message and an OK button, which will be in the center of its parent component.API javax.swing. Timer 1.2Timer (int interval, ActionListener Listener)Constructs a timer that advertises listener once every interval millisecond.void Start ()Start the timer. Once the boot is successful, the timer invokes the listener's actionperformed.API void Stop ()Stop the timer, and once the stop is successful, the timer will not be actionperformed to call the listener.Java. Awt. Toolkit 1.0Sta
comparable2publicint Comparato (Employee Other)3 {4 return Double. Compare (salary, other.salary); 5 }}Note the type conversion of the Object parameterWhy not provide a Comparableto method directly in the employee class? The main reason is that Java is a strongly typed (strongly typed) language. When the method is called, the compiler checks to see if the method exists.1 PackageCc.openhome;2 Importjava.util.Arrays;3 Public classJiekou {4
1. Static constants:Static variables are used relatively little, but static constants are used more, for example, a static constant is defined in the Math class:public static Final PI = 3.141592653;In the program, this constant can be obtained in the form of Math.PI.If the keyword static is omitted, Pi becomes an instance field of the math class and needs to be accessed through an object of the math class, and each math object has its own copy of Pi."Java
.
Boolean replace (K key,v oldvalue,v newvalue)
If the given key is currently associated with oldvalue, it is associated with the newvalue. otherwise returns falseCopy of the Write arraycopyonwritearraylist and Copyonwritearrayset are thread-safe collections. all of the modified threads replicate the underlying array. This arrangement is useful if the number of threads iterating over the collection exceeds the number of modified threads. When constructing an iterator, it contains a
different method for computing shipping CH Arges, but it other methods, such as adding items and billing, is inherited from the Order class. In general, if Class A is extends Class B, Class A inherits methods from class B but have more capabilities. (We describe inheritance more fully with the next chapter, in which We discuss this important notion at some length.) Many programmers use the UML (Unified Modeling Language) notation-draw class diagrams that describe the relationships B Etween clas
of a larger application and then your start the application withJava ApplicationAnd the main method of the Employee class is never executed.The program in Listing 4.3 contains a simple version of the Employee class with a static field NextID and a static met Hod Getnextid. We fill an array with three employee objects and then print the employee information. Finally, we print the next available identification number, to demonstrate the static method.Note that the Employee class also have a stati
.
Annotation
Purpose
@Generated
Code Generator Tools
@PostConstruct @PreDestroy
in environments that control the Life-circle of Objects-methods Tagged with these annotations should is invoked immediately after a object has been constr Ucted or before is being removed.
@Resource
resource injection
@Target ({elementtype.x, elementtype.y, ...})
apply to
for another thread to notify the scheduler of a condition, it enters its own wait state. This occurs when you call the Object.wait method or the Thread.Join method, or you wait for lock or condition in the Java.util.concurrent library.
Timed Waiting (timed Wait)
There are several methods that have a timeout parameter. Calling them causes the thread to enter a timed wait (time waiting) state. This status will be maintained until the timeout expires or the appropriate notification i
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.