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 will you initialize an Applet?

1201


What's the purpose of using break in each case of switch statement?

1041


What is a char in java?

1094


What are 4 pillers of object orinted programming?

1074


Explain different types of wrapper classes in java?

1072


What access modifiers can be used for variables?

1205


Assume a thread has lock on it, calling sleep() method on that thread will release the lock?

1158


What do you know about the garbate collector?

1082


Java.util.regex consists of which classes?

1042


Is string a class in java?

1031


Why pass by reference is not possible in java?

1108


Can we use static class instead of singleton?

1098


Explain about the main() method in java?

1178


What is the difference between serializable and externalizable interface?

1164


What are different data types?

1079