Sunday, January 9, 2011

JAVAAAAAA


courtesy : careercup 
intern() method of String class returns canonical representation for the string object from string pool.
so even if two string object have same value and return false on == comparision
string1.intern()==string2.intern() returns true.

daemon thread is a low priority thread that is terminated as soon the vm exits.
It is generally used to do all the house keeping work like gc thread is a daemon thread.
It can be set using
thread.setDaemon(true);
And then start the thread.
The main thread terminates it if it is finished.


final class A {}
 means that A cannot be further extended or subclassed. 
This feature has a couple of big implications. One is that it allows control over a class, so that no one can subclass the class and possibly introduce anomalous behavior. For example, java.lang.String is a final class. This means, for example, that I can't subclass String and provide my own length() method that does something very different from returning the string length. 

No comments:

Post a Comment