请帮我看看这个通配符泛型错在哪里?
public static void main(String[] args)
{
Employee a = new Employee("abc", 2000);
Employee b = new Employee("efg", 6000);
A<Employee> c = new A<Employee>(a ,b);
}
public static void printC(A<? extends Employee> p)
{
Employee first = p.getFirst();
Employee second = p.getSecond();
}
import java.util.*;
public class Test2
{
public static void main(String[] args)
{
Employee a = new Employee("abc", 2000);
Employee b = new Employee("efg", 6000);
A<Employee> c = new A<Employee>(a ,b);
}
public static void printC(A<? extends Employee> p)
{
Employee first = p.getFirst;
Employee second = p.getSecond;
}
}
class A<T>
{
public A(T first, T second)
{
this.first = first;
this.second = second;
}
public T getFirst()
{
return first;
}
public T getSecond()
{
return second;
}
public void setFirst(T newValue)
{
first = newValue;
}
public void setSecond(T newValue)
{
second = newValue;
}
private T first;
private T second;
}
class Employee
{
String name;
double salary;
public Employee(String name, double salary)
{
this.name = name;
this.salary = salary;
}
}