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

What is a conditional statement explain with example?

737


What is a key in java?

685


enlist some features of jdk.

728


Explain differences between collection api and stream api?

815


Give me an example of array and linked list? Where they can be used?

750






What are the two environment variables that must be set in order to run any java programs?

706


What are synchronized methods and synchronized statements in java programming?

769


Where local and global variables are stored?

754


What is the difference between Java and C++?

808


What does indexof return in java?

720


How do listeners work?

716


If an application has multiple classes in it, is it okay to have a main method in more than one class?

731


What restrictions are placed on method overloading in java programming?

745


Explain about main thread in java?

836


What is the use of http-tunneling in rmi?

772