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
How to declare objects of a class ?
How does arraylist work in java?
What is t type java?
What is == in java?
Difference between character constant and string constant in java ?
What is a default constructor and also define copy contrucyor?
What is java command?
What is rmi and steps involved in developing an rmi object?
Which method returns the length of a string?
How to obtain a performance profile of java program
Difference between stack and queue?
What is the difference between == and === javascript?
Write a program to solve producer consumer problem in java?
Can we use switch statement with strings?
Explain the differences between static and dynamic variables?