主题:SCJP Question
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public class TestCollections {
List<Integer> list1= new ArrayList<Integer>();
static TestCollections tc = new TestCollections();
public static void main(String[] args){
//insert code here
}
static List getList(){
return tc.list1;
}
}
To make the above code compilable, to choose option(s)...
A. tc.list1.add(99);
B. getList().add(88);
C. list1.add(92);
D. getList().add("hello");
Ans is A, B, D.
http://sites.google.com/site/smilejava2/Home
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public class TestCollections {
List<Integer> list1= new ArrayList<Integer>();
static TestCollections tc = new TestCollections();
public static void main(String[] args){
//insert code here
}
static List getList(){
return tc.list1;
}
}
To make the above code compilable, to choose option(s)...
A. tc.list1.add(99);
B. getList().add(88);
C. list1.add(92);
D. getList().add("hello");
Ans is A, B, D.
http://sites.google.com/site/smilejava2/Home