Difference between array and arraylist.

Answer Posted / sakshi jauhari

Arraylist is written as
ArrayList<String> arr= new ArrayList<String>();
whereas array is specified for a single data type object
only like..
int[] ar = new int[6];

Arraylist can be specified for any data type object that it
can store.
its range can also be resized which is not possible in
array.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you create a first line indent?

510


What is difference between word and integer?

598


What is singleton class and how can we make a class singleton?

661


Is empty string in java?

544


Does constructor be static?

568






What is nullpointerexception in java?

528


What is bifunction in java?

682


Is c better than java?

547


What is wrapper class html?

531


Can an integer be null java?

561


What is a marker interface?

580


Where are variables stored?

556


Explain the available thread states in a high-level?

532


What is a final class ?

607


Can we rethrow the same exception from catch handler?

569