imgopi
Help!!!
Friends i want to know the exact difference between Arraya
and Linked Arrays in java.They both look like same in functionalists,but what is the main difference.Any one know the exact answer please provide it.
posted Friday, August 11, 2006 1:34 PM
![[IMG]](proxy.php?image=http%3A%2F%2Fwww.coderanch.com%2Ftemplates%2Fdefault%2Fimages%2Fthumbs-up.gif&hash=9eea1fd5b06124b9e7b9c7e0a8ede904)
Originally posted by pawar santosh:
Can anybody tell me exact difference between Linked List and Array List.
Please give Example By Usage of Both in JavaCode.
Thanks in Advance.
Well Gopi,
The biggest difference between is
Linked Arrays are meant for sequential accessing. ArrayList are meant for random accessing.
Although you can check out the books on Collections for time being I can tell you.
An Array is a "special" object in Java that has very few methods. You can access the value in the array the [ ] brackets, and you can determine the length (the .length) property, and thats about the extent of the Array. The array has a FIXED size that cannot be changed.
The ArrayList is part of the Collections Framework. It is a List that is built on top of an array. It provides methods to add to the list (thereby changing the size), as well as to obtain an iterator, and to remove elements, sort elements, and perform searches. Basically, it saves you from having to write that code when using an array.
The LinkedList is also a List. It essentially provides the same methods as the <a href="https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html" target="_blank" rel="nofollow noopener noreferrer">ArrayList (Java Platform SE 7 )</a>, except the underlying data structure uses objects that contain references to other objects to form a list. This is "similar" to the concept other languages call "pointers" (but not quite the same).
I hope I make it clear.