Skip to main content

ArrayList

1 reply [Last post]
renzord
Offline
Joined: 2007-10-18
Points: 0

This is my testing code: I want to create a ArrayList of objects Myclass1
public class Mainclass {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("TEST");
Myclass1 mc1= new Myclass1();
Myclass2 mc2= new Myclass2();

}

}
public class Myclass1 {
public Myclass1 (){
System.out.println("TEST MYCLASS1");
}
}

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;

public class Myclass2 {

ArrayList myclass = new ArrayList();

}

And I get this error.: Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The type ArrayList is not generic; it cannot be parameterized with arguments
Syntax error, parameterized types are only available if source level is 5.0

It seems to work on windows vista, but in winxp, which I am using now, it doenst work. Help please.

Thanks in advance

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ihepda
Offline
Joined: 2003-11-21
Points: 0

Build with -source 5 option