Monday, 24 September 2012

Java Links

Java Links


           Difference between String object ( using new ) and String pool ( without new )
           http://www.coderanch.com/t/381271/java/java/Difference-between-String-Marcus-vs

           Anonymous Classes
           http://wiki.answers.com/Q/What_is_anonymous_class_in_java
           http://www.roseindia.net/javatutorials/anonymous_innerclassestutorial.shtml
           http://www.java2s.com/Code/Java/Class/Thisprogramdemonstratesanonymousinnerclasses.htm

            Use of Serial VersionUID
            http://c2.com/ppr/wiki/JavaIdioms/AlwaysDeclareSerialVersionUid.html
            http://stackoverflow.com/questions/2258676/what-is-serial-version-id-in-java
            http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html

If a serializable class does not explicitly declare a serialVersionUID, then the serialization runtime will calculate a default serialVersionUID value for that class based on various aspects of the class, as described in the Java(TM) Object Serialization Specification. However, it is strongly recommended that all serializable classes explicitly declare serialVersionUID values, since the default serialVersionUID computation is highly sensitive to class details that may vary depending on compiler implementations, and can thus result in unexpected InvalidClassExceptions during deserialization. Therefore, to guarantee a consistent serialVersionUID value across different java compiler implementations, a serializable class must declare an explicit serialVersionUID value. It is also strongly advised that explicit serialVersionUID declarations use the private modifier where possible, since such declarations apply only to the immediately declaring class--serialVersionUID fields are not useful as inherited members. Array classes cannot declare an explicit serialVersionUID, so they always have the default computed value, but the requirement for matching serialVersionUID values is waived for array classes 


             Dependency Injection : 
In any application objects dependency can be handled in two ways
1. Object can initialize its dependent objects in its implementation, either by direct object creation or through its constructor. ( It becomes difficult to modify the implementation structure)
2. Using DI container. example Spring
Short intro on DI
              http://www.youtube.com/watch?v=Hm2fTv9wikI&feature=g-vrec






No comments:

Post a Comment