黑马程序员技术交流社区
标题:
哈尔滨校区 eclipseF3不显示源代码怎么回事啊?
[打印本页]
作者:
陈胜
时间:
2016-1-26 23:47
标题:
哈尔滨校区 eclipseF3不显示源代码怎么回事啊?
本帖最后由 陈胜 于 2016-2-29 23:26 编辑
eclipseF3不显示源代码怎么回事啊?
作者:
Mayer
时间:
2016-1-27 09:55
instanceof 运算符是用来在运行时指出对象是否是特定类的一个实例。
class Student implements Comparable//该接口强制让学生具备比较性。
{
private String name;
private int age;
Student(String name,int age)
{
this.name = name;
this.age = age;
}
public int compareTo(Object obj)
{
//return 0;
if(!(obj instanceof Student))
throw new RuntimeException("不是学生对象");
Student s = (Student)obj;
System.out.println(this.name+"....compareto....."+s.name);
if(this.age>s.age)
return 1;
if(this.age==s.age)
{
return this.name.compareTo(s.name);
}
return -1;
/**/
}
public String getName()
{
return name;
}
public int getAge()
{
return age;
}
}
复制代码
作者:
陈胜
时间:
2016-1-28 00:18
。。。?
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2