SCJP, SCWCD
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class.
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class.
Strings are constant; their values cannot be changed after they are created. String buffers support mutable strings. Because String objects are immutable they can be shared. For example:
String str = "abc";
is equivalent to:
char data[] = {'a', 'b', 'c'};
String str = new String(data);
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
String buffers are used by the compiler to implement the binary string concatenation operator +. For example, the code:
String x = "a" + 4 + "c"
is compiled to the equivalent of:
String x = new StringBuffer().append("a").append(4).append("c").toString()
which creates a new string buffer (initially empty), appends the string representation of each operand to the string buffer in turn, and then converts the contents of the string buffer to a string. Overall, this avoids creating many temporary strings.
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
SCJP, SCWCD
SCJP2. Please Indent your code using UBB Code
string literals can be g.c.ed donwloading the class that declared them.
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
SCJP2. Please Indent your code using UBB Code
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
SCJP2. Please Indent your code using UBB Code
SCJP2. Please Indent your code using UBB Code
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
SCJP2. Please Indent your code using UBB Code
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
* An object is strongly reachable if it can be reached by some thread without traversing any reference objects. A newly-created object is strongly reachable by the thread that created it.
* An object is softly reachable if it is not strongly reachable but can be reached by traversing a soft reference.
* An object is weakly reachable if it is neither strongly nor softly reachable but can be reached by traversing a weak reference. When the weak references to a weakly-reachable object are cleared, the object becomes eligible for finalization.
* An object is phantom reachable if it is neither strongly, softly, nor weakly reachable, it has been finalized, and some phantom reference refers to it.
* Finally, an object is unreachable, and therefore eligible for reclamation, when it is not reachable in any of the above ways.
SCJP2. Please Indent your code using UBB Code
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |