Difference between array and arraylist.

Answer Posted / mohammad fazulullah

Array is the object and it stores the object of same type

Eg : Its stores complete integer types or string types

int[] IntArray = new int[3];
string[] StringArray = new StringArray[2];

Arraylist is the collection in which we can store the
objects of any data type.

Eg : Arraylist Arr = new Arraylist()
Arr.Add(13); // Integer Type
Arr.Add(10); // String Type

2 . Arrays has the Fixed Lenght where as the Arraylist
varies the leghth as the objects Added.

Is This Answer Correct ?    196 Yes 32 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is java 9 released?

516


Why does java doesnt suuport unsigned values?

1784


What is stream api in java8?

522


what is thread? What are the high-level thread states? Or what are the states associated in the thread? : Java thread

482


What is the difference between a constructor and a method?

554






Can private class be extended java?

550


How do you find the maximum number from an array without comparing and sorting?

626


What is the use of bufferedreader?

518


How to declare objects of a class ?

576


Can we force the garbage collection to run?

521


Difference between nested and inner classes ?

591


I want to persist data of objects for later use. What’s the best approach to do so?

490


What are thread local variables?

536


What is default size of arraylist in java?

547


Can we use string in the switch case?

565