Posts

JAVA Annotations

JAVA Annotations              JAVA Introduced annotations in the release of 5.  To make anything behave as annotation mainly we have about  3 interfaces documented, Retention and target. Documented :           Documented is an interface where if any interface acts as annotation it should annotate with @Documented and it should use @interface for annotation. The documentation interface does not contain any methods but it is not a marker interface as it is used as a meta-annotation. It’s applied to other annotations and should be documented by tools such as Javadoc. Retention :      Retention indicates how long annotations with an annotated interface are to be retained. The default behavior of retention is CLASS. We have to annotate with @Retention and send the arguments to the method value of an ENUM, RetentionPolicy.   RetentionPolicy...

JAVA Collections

JAVA Collections      Arrays :                     Arrays are collection of elements which are of same type . Arrays can store both primitive and reference objects. We have to define the size of an array while initialising the array like below.               int[] intArray = new int[3];      Where 3 is size of an array,        To check the length of an array we can use .length . There is no option to remove   an element from an array just we have to point   an object to null and we cannot change the size of an array. When we try to add element at index which is greater than the size of an array then JAVA will throw Array IndexOutofBound Exception.        So ., The main disadvantages of Array is that it doesn’t contains any methods to do all the operations. And The size of an array will not dynamically change.    ...