How will you convert an ArrayList to Arrays?
Answers were Sorted based on User's Feedback
Answer / vikneswarank
Using toArray() method for example
ArrayList arr_obj=new ArrayList()
arr_obj.add("viki");
arr_obj.add("siva");
Object[] obj=arr_obj.toArray();
for further Detail go to my website :
http://www.beexpert.co.in/
Is This Answer Correct ? | 11 Yes | 2 No |
Using toArray() method for example
ArrayList arr_obj=new ArrayList()
arr_obj.add("viki");
arr_obj.add("siva");
Object[] obj=arr_obj.toArray();
for further Detail go to my website :
http://www.beexpert.co.in/
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / 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 |
Answer / ramesh
ArrayList arr_obj=new ArrayList()
arr_obj.add("viki");
arr_obj.add("siva");
Object[] obj=arr_obj.toArray();
Is This Answer Correct ? | 1 Yes | 0 No |
how to write a program for sending mails between client and server
Is map ordered in java?
Is it possible to use Semaphore/ Mutex in an Interrupt Handler?
what is the Diff. between Access Specifiers and Access Modifiers?
39 Answers BMC, Cyber Shot, Infosys, VTS, Wipro,
What is the default size of set in java?
What is a void in java?
How do you sort a list in java?
Why string is not thread safe?
Suppose there is an Online shopping cart application having different objects like Cart, SelectionItem, Billing, COnfiguration, Authentication, Authorization, PersonalDetails etc. Out of this which one can be made a singleton pattern and why?
What is a short in java?
How does arrays sort work in java?
Is java still relevant?