Tuesday, June 8, 2010

what is serialVersionUID ?

Everytime you write a class that implements serializable interface the IDE shows a warning asking to add serialversionUID, I wondered why couple of times but looked it up to find the reasons..

Below is a good link that explains why... the point to note is serialVersionUID is an exception to the rule that “static fields don’t get serialized”

http://www.javablogging.com/what-is-serialversionuid/

Monday, May 24, 2010

Memory leaks in JAVA..

Whenever question was asked about Memory management in JAVA (vs) Memory management in C++, the only thing I knew of is that

- in C++, memory leaks can occur and programmer needs to take care of them by writing cleanup code. and there is also a problem of dangling pointers.
- Clearly in JAVA, garbage collector takes care of memory management, in the sense, it cleans up all the objects to which no references are left. Clearly problem of dangling pointers is addressed. But Is it the same case with Memory leaks ?

There is more to memory leaks in JAVA - some good links.

http://www.ibm.com/developerworks/rational/library/05/0816_GuptaPalanki/

http://jb2works.com/memoryleak/index.html

http://jb2works.com/memoryleak/topfive.html

Sunday, April 25, 2010

System.getproperty()

From http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html

System.getproperty() gets the system property specified by the key, also there is a System.getproperty(String key, String def) where default value can be specified. Helps while setting constants in JAVA program with some default values.