你把方法定义到main函数干嘛??
解决方案 »
- ssh2 哪些知识比较常用的
- java 入门问题,谢谢回答
- ssh连接的奇怪问题
- jaxb异常 Class has two properties of the same name "username"
- 请问Java对象用做方法参数是“传值”还是对象的“引用”????请高手解答!!!
- 菜鸟的一个简单问题(实际上是非常有用的知识点),请高手指点指点!!!!
- 一段关于对象序列化的代码,帮忙看看
- 怎么用字符串数组去匹配字符串?
- public class cuowu extends JFrame implements ItemListener{
- 一个对象可以属于两种类型吗?
- 神,如何在子窗口中调用父窗口的变量?
- 菜鸟的多线程问题
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();
}语法错误
{
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;
}
}
我用的是ultraedit。真牛逼 你为啥不用记事本
<? super T> p 表示 p只能是T类型或T的父类类型直至Object类型
我用的是ultraedit。真牛逼 你为啥不用记事本我看到网上一个视频用的这个,我也用这个。记事本好像没有这个好用,起码这个关键字会用不同颜色显示,记事本估计没有这个功能。我也安装了eclipe,但是好像太复杂,就没有用。