Results 1 to 4 of 4
Thread: Arrays or ArrayLists
- 12-17-2010, 01:13 AM #1
Member
- Join Date
- Nov 2010
- Posts
- 14
- Rep Power
- 0
-
Why not try it and see what happens? But in general if your collection will have a variable sized number of members, then use an ArrayList, and if a fixed number, then an array. Much luck.
- 12-17-2010, 01:20 AM #3
Member
- Join Date
- Nov 2010
- Posts
- 14
- Rep Power
- 0
I tried something like this for the main method:
code:
import java.util.*;
public class ArrayListClassDemo {
public static void main(String args[]) {
ArrayListClass yes = new ArrayListClass();
yes.add("C");
yes.add("A");
}
}
and for the class i did this. I know this is totally wrong. Please guide me.
import java.util.*;
public class ArrayListClass {
public ArrayListClass() {
}
public void makeArray() {
// create an array list
ArrayList al = new ArrayList();
System.out.println("Initial size of al: " + al.size());
}
}
-
I can't really read your code without code tags, and I ask you to please edit your post above and use code tags. This has been requested of you before, in fact just yesterday. To see how to do this, please read the first link in my signature links below.and for the class i did this. I know this is totally wrong. Please guide me.
Similar Threads
-
array of ArrayLists
By imorio in forum New To JavaReplies: 8Last Post: 09-24-2011, 01:05 PM -
ArrayLists
By Freakzoyd in forum New To JavaReplies: 4Last Post: 11-12-2010, 04:27 AM -
ArrayList of ArrayLists
By coolnfunky_raj in forum New To JavaReplies: 10Last Post: 07-03-2008, 10:07 AM -
arraylists problem
By newtojava7 in forum New To JavaReplies: 1Last Post: 03-12-2008, 07:38 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks