Thursday, August 5, 2010

Java One Liner...

1. Static methods can not be overwritten. A call to a static method is dependent on the type of the identifier and not on the object's class.

2. String fileContent = new Scanner(new File("test.txt" )).useDelimiter("\\z").next(); it reads in the entire file at once.

3. A Monostate object has static member variables only. So all instances of a Monostate class share the same state. This is a rare pattern and it is used less.

4. Antipatterns -- "a commonly occurring solution to a problem that generates decidedly negative consequences".

5. Use “==” operator while performing value comparison, with Value Type and use “Equals()” method while performing value comparison with Reference Type.

No comments:

Post a Comment