|
INTERVIEW QUESTIONS
J2EE
JAVA
DETAILS
Question: What is the difference between array list and linked list. in which situations we are use them? which is best one?
Answer: public class ArrayList extends AbstractList implements List, RandomAccess, Cloneable, Serializable Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. (This class is roughly equivalent to Vector, except that it is unsynchronized.)
public class LinkedList extends AbstractSequentialList implements List, Cloneable, Serializable Linked list implementation of the List interface. Implements all optional list operations, and permits all elements (including null). In addition to implementing the List interface, the LinkedList class provides uniformly named methods to get, remove and insert an element at the beginning and end of the list. These operations allow linked lists to be used as a stack, queue, or double-ended queue (deque).
|
|
|
Category |
Java Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 8359 users |
Added on |
8/14/2011 |
Views |
67755 |
Rate it! |
|
|
Question:
What is the difference between array list and linked list. in which situations we are use them? which is best one?
Answer:
public class ArrayList extends AbstractList implements List, RandomAccess, Cloneable, Serializable Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. (This class is roughly equivalent to Vector, except that it is unsynchronized.)
public class LinkedList extends AbstractSequentialList implements List, Cloneable, Serializable Linked list implementation of the List interface. Implements all optional list operations, and permits all elements (including null). In addition to implementing the List interface, the LinkedList class provides uniformly named methods to get, remove and insert an element at the beginning and end of the list. These operations allow linked lists to be used as a stack, queue, or double-ended queue (deque). Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
Can i expand an interface?
|
View Answer
|
|
what happens if we execute the program? class Return{ int display(){ try{ return 1; } finally{ return 2; } } public static void main(String args[]){ Return r=new Return(); r.display(); } }
|
View Answer
|
|
If interface has got four methods,and I like to implement only two methods, how this could be achieved?
|
View Answer
|
|
Does JVM maintain a cache by itself? Does the JVM allocate objects in heap? Is this the OS heap or the heap maintained by the JVM? Why
|
View Answer
|
|
What are the primitive types in Java?
|
View Answer
|
|
How would you implement a thread pool
|
View Answer
|
|
How do you declare constant values in java?
|
View Answer
|
|
Do primitive types have a class representation
|
View Answer
|
|
When you have an object passed to a method and when the object is reassigned to a different one, then is the original reference lost
|
View Answer
|
|
What is a memory footprint? How can you specify the lower and upper limits of the RAM used by the JVM? What happens when the JVM needs more memory
|
View Answer
|
|
When you use a struts framework, where would you place your business logic
|
View Answer
|
|
How all can you free memory
|
View Answer
|
|
Does java do reference counting
|
View Answer
|
|
What does a static inner class mean? How is it different from any other static member
|
View Answer
|
|
What are the differences between JIT and HotSpot
|
View Answer
|
|
What are the disadvantages of reference counting in garbage collection
|
View Answer
|
|
What is EJB
|
View Answer
|
|
What is the sweep and paint algorithm
|
View Answer
|
|
What is reflection API? How are they implemented
|
View Answer
|
|
What is the primary advantage of XML driven Java Beans
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All Java Interview Questions & Answers - Exam Mode /
Learning Mode
|