JDK source of the 1 (Lang Pack Supplements)

2010-06-29  来源:本站原创  分类:Java  人气:357 

1, the basic type of the corresponding object types: We know the basic types in Java: void byte char double float integer long short
The corresponding object types, respectively: Void Byte Character Double Float Integer Long Short, In fact, these classes have a final member of the type of basic types, such as
Byte class members inside private final byte value, since its members are final, so a Byte only in its beginning when the specified value of its after immutable.
Achieved in the corresponding object type in the basic type is implemented by native (Class <Byte>) Class.getPrimitiveClass ("byte") to get the.
What is interesting is: In the JDK1.5 after the object type in the inside of each cache -128 - 127 corresponding to the object type, just call their troops under the static method valueOf (byte b) (cache only the method used), If the scope of its parameters provided in the context of the cache, but no
New Byte () but from the cache to obtain pre-New's Byte.

2, as all objects of "ancestor", Object class has a number of important ways, such as getClass hashCode clone notify notifyAll wait methods are native to. So you call these methods at the time should know that you call the virtual machine-level native application.

3, Class class, in Java, including basic data types such as int in fact is a Class is a Class, in reflection of this class are a large number of applications, in fact, the importance of its internal methods such as: forName isInstance isArray isPrimitive getName getSimpleName getDeclaredFields getDeclaredMethods getDeclaredConstructors
Are native, ie the virtual class level has achieved these things. Why does Java support for reflection, in fact, that white is the existence of this Class, each class has its corresponding metadata existence, JVM metadata information in the native way to get through. In fact, it plainly is also reflected as the legendary so well, if I come to realize the KAVA language based on JAVA virtual machine
(Assuming the conditions set up), then I will compile some of this class during the description of the information, if the number of field ah, ah field names etc. I use java stored into a data structure to achieve, and then KAVA by calling JAVA program to get that information, in fact, with the reflection that the same reason.

4, the String, String within a matter of fact is final char [], because it is final, so if you want to change its internal character, may create a new String. If you want to create a new string object but want to make changes have to use JDK1.5 after a class StringBuilder, this class so neglected thread synchronization is more efficient than StringBuffer. Also on the String does not mention is similar to the String a = "abc"; String b = "abc"; the practice, as "abc" already did during compilation, so
JVM will keep a copy of "abc", it simply is not a very deep stuff, any one of the students learned compiler theory know that this is any compiler optimization must be done. String know the "wheels" of the bottom after you regret you write in more than a large number of applications N String add procedures?
If these characters have a way around it in order that replaced StringBuilder.append. As for the String.format method has been tested even less efficient adding strings.

5, some important basic interfaces such as Cloneable Comparable Iterable, Readable Runnable, thanks to the power of programming to interfaces, implementation under a N-ah

6, a number of predefined annotation such as: Deprecated Override SuppressWarnings the mark of 1.5 is the future of programming when applied.

7, and thread the Thread ThreadGroup that main method is native to. There is also a ThreadLocal in fact not a novel, just so that different threads of different backup operations, operating systems theory there.

8, and mathematics-related Math StrictMath are all static methods of use, mainly used for data calculation.

9, Enum was added after the 1.5 are quite useful, in fact, is only maintained its internal name and the order of enumeration, such as enum A (BOY, GIRL), is it actually BOY name, its order 1 (maybe 0), GIRL is name, the order of 2 (probably 1);
This class can not be instantiated, can only be free to build through the statement keyword enum enumeration, you can get in the program set for each enumeration, not because the API provides the interface, but because the enumeration created when the compiler will do some "hands."

10, abnormal levels of the following:

Throwable ---->
----> RuntimeException

It is noteworthy that the standards set in the SUN, RuntimeException is not required to try ... catch, when you are doing a component for others to call, but do not want others to use try ... catch way to use When your component, you can throw a RuntimeException or a subclass of Exception.

11, some not commonly used, but can provide a very useful feature of class
Process and ProcessBuilder creating process, if you want to use ipconfig command parameters can be obtained through its network card
Runtime environment for running programs can get some stuff, such as the number of host CPU, memory size and other information.
System Needless to say, and can get out, in, errr flow, 1.5 after the addition of a console is used mainly to facilitate the console programming
management package can be obtained by ManagementFactory including compiler, operating system management bean to get information such as operating system architecture. But the package only contains a number of management bean interface, implementation class in com.sun.management.

  • JDK source of the 1 (Lang Pack Supplements) 2010-06-29

    1, the basic type of the corresponding object types: We know the basic types in Java: void byte char double float integer long short The corresponding object types, respectively: Void Byte Character Double Float Integer Long Short, In fact, these cla

  • Eclipse JDK source associated 2010-05-16

    Original link: http://ajava.org/course/tool/14485.html 1. Point "window" -> "Preferences" -> "Java" -> "Installed JRES" 2. Then "Installed JRES" is the right list pane, lists the system JRE enviro

  • ubuntu install jdk source 2010-12-26

    sudo apt-get install sun-java6-source To install the JDK's source, install in the directory / usr/lib/jvm/java-6-sun-1.xxxx sudo apt-get source sun-java6-bin Source version of the JDK installation

  • JDK source research 2Java set design 2010-06-29

    Collection Interface System: Iterable ----> Collection ----> List ----> Set ----> SortedSet ----> NavigableSet (6.0) ----> Queue ----> Deque Map ----> SortedMap ----> NavigableMap (6.0) Collection class system: Collection ----&g

  • JDK source of the util utility class 2010-06-29

    BitSet: bit set to achieve a common logical operation. Calendar: Date of many obsolete methods in such a reality. It is an abstract class, there are two implementations were GregorianCalendar and JapaneseImperialCalendar Formatter: String.format () m

  • JDK source of the miscellanies 2010-06-29

    java.util: util.regex on the regular expression handling package, which is the lengthy processing logic, no depth, that is, a common Pattern and Matcher, combination of these two classes to finish the regular expression programming, but based on past

  • JDK source learning - LinkedList 2010-06-04

    public class LinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E>, Cloneable, java.io.Serializable private transient Entry<E> header = new Entry<E>(null, null, null); // The head of the queue pub

  • JDK source code of the concurrent 2010-06-29

    ava.util.concurrent package contains the framework of Java concurrent programming solution 1, synchronized: each object in JAVA actually has a hidden lock object, as to the method with the equivalent of the object when szhcnronized with synchronized

  • JDK source code of the IO of 2010-06-29

    A typical IO operation is the read InputStream and OutputStream to wite (byte b) as the standard, InputStream time to receive one or more bytes, while the OutputStream will write one or more bytes. Emerged from JDK1.1 to start operating as a standard

  • JDK source of the bean bag 2010-06-29

    java.beans 1, Statement Can perform the specified method, but can not get return value 2, Exception is a subclass of Statement, the specified method and return value are specified in the Java method name in the implementation of the method can be use

  • JDK source code of the sql package 2010-06-29

    java.sql 1, JDBC is a set of protocols, is JAVA developers and database vendor agreement, that is, a set of interfaces defined by the Sun, by the database vendor to implement, and provides for JAVA developers to access the database used by the method

  • JDK ArrayList Source Analysis 2010-12-22

    Today looked at the source ArrayList to write about their own experiences ArrayList first integrated system, the code is as follows: public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.S

  • JDK LinkedList Source Analysis 2010-12-23

    Then today, another of about JDK collection classes in the LinkedList. public class LinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E>, Cloneable, java.io.Serializable As you can see the same LinkedList an

  • java.lang.UnsupportedClassVersionError 2008-07-11

    NLP research has grammarscope, the result looks like grammarscope compiled with what looked like a 1.6, and 1.5, I listed the machine, so Baocuo. Such a mistake can only be re-installed 1.6, unless I use jdk1.5 to re-compile its source code. Fact jav

  • JDK learning search algorithm 2010-04-13

    Today we learn of two commonly used search algorithms: sequential search and binary search, no BS, the first on the code, later analysis: 1. Here are two kinds of search algorithm, in which the second taken from the JDK source code: Sequential search

  • DataInputStream class design error source 2010-05-08

    I am a Java beginner, please predecessors Xiangjie. Yesterday, when this part of learning Java stream, see jdk source code, personal feel sun in the design DataOutputStream this class is not appropriate or even a BUG. DataInputStream in a method read

  • [JDK optimization strategy] java.util.Arrays sort of 2010-05-12

    On the inscription: JDK, there are many algorithm has the bright spot, it is worth to study. ] [Java.uti.Arrays to operate the array contains (such as sorting and searching) in various ways. This article we study a number of masters to write sorting

  • java.lang.reflect.InvocationTargetException (in the configuration hibernate connection pool using proxool Times solution to this exception) 2010-07-21

    Exception: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at

  • Source with the mind 2010-09-04

    Recent studies of the source code under the struts2.2.1 bottom see many sets of applications, realize their own understanding of Set and Map is not in place, what Set, Entry of the class of all Sha Sha Sha Well, Well, the book opened fill up classes,

  • JDK 1.6 installed Ubuntu 10.04 2011-07-06

    To build under Ubuntu's java development environment, spend a great strength but is always is installed, although there are many online tutorials to teach you how to install, but I write only to miss the University of the eggs had never been seen Dao