Thursday, 22 September 2011

What are the differences between ArrayList and LinkedList? java interview questions....

Answer: 
  • it's is a List implementation backed by a Java array, like Vector class
  •  If there are lots of growth periods, performance degrades as the old array needs to be copied into the new array.
  •  However, random access is very quick as it uses an array index to access.
  • LinkedList, the List implementation is backed by a doubly linked list data structure, allowing easy inserts/deletions anywhere in the structure, but really slow random accesses as the access must start at an end to get to the specific position.

for more answers click here



Monday, 19 September 2011

java interview questions ...


What is a static method? java interview questions..

Ans:
  • Static variables are always called by the class name.
  • Class variables or static variables are declared with the static keyword in a class. These are declared outside a class and stored in static memory.
  • The scope of the class variable is same an instance variable. 
  • A static variable is associated with the class as a whole rather than with specific instances of a class. Each object will share a common copy of the static variables .
  •  Class variables are mostly used for constants Its initial value is same as instance variable and gets a default value when its not initialized corresponding to the data type.

for more answers click here