Java基础:
下面的类里有几处
错误? 不通过工具,你能很快的找出来吗?试一下吧!
class="java" name="code">
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.junit.Test;
public class Test {
static class Person {
public void m(Collection<Person> persons) {
}
}
static class Employee extends Person {
public void <T> test() {
}
}
static class Student extends Person {
public void m2(Collection<Student> students) {
super.m(students);
}
}
public void arrayStoreExceptionTest() {
Person[] persons = new Employee[5];
persons[0] = new Employee();
persons[1] = new Student();
}
@Test
public void arrayStoreTest() {
Person[] persons = new Person[2];
persons[0] = new Employee();
persons[1] = new Student();
}
public void genericTest() {
List<Person> personList = new ArrayList<Employee>();
}
static class Generic<T> {
static T t;
static void method1(T t) {
}
void m1(T t){
}
}
}