Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How will you convert an ArrayList to Arrays?

Answer Posted / vikas

using toArray() method.
example:

ArrayList<Integer> al = new ArrayList<Integer>();
al.add(1);
al.add(5);
al.add(8);
al.add(10);

//Get the array
Integer tempArray = new Integer[al.size()];
tempArray = al.toArray(tempArray);

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to declare objects of a class ?

1077


How does arraylist work in java?

1120


What is t type java?

1060


What is == in java?

1016


Difference between character constant and string constant in java ?

1022


What is a default constructor and also define copy contrucyor?

1108


What is java command?

1082


What is rmi and steps involved in developing an rmi object?

1065


Which method returns the length of a string?

1036


How to obtain a performance profile of java program

1034


Difference between stack and queue?

1075


What is the difference between == and === javascript?

1180


Write a program to solve producer consumer problem in java?

1011


Can we use switch statement with strings?

1045


Explain the differences between static and dynamic variables?

1150