java高手们看看加**这几行代码什么意思,解释一下,谢谢!

来源:百度知道 编辑:UC知道 时间:2024/05/24 03:23:37
class desktop
{
int price,configuration;
void work()
{
// System.out.println("work");
}
void sleep()
{
// System.out.println("sleep");
}
void movement()
{
System.out.println("hard");
}
}
class portable extends desktop
{
int price=4000;
void movement()
{
System.out.println("easy");
}
}
class integration
{
** static void ab(desktop de)
** {
** de.movement();
** }
public static void main(String[] arg)
{
** portable por=new portable();
** desktop de;
** de=por;
** integration.ab(de);
// por.work();
// por.sleep();
// por.movement();
// System.out.println("price of por="+por.price);
}
}

是个简单的继承,可能是想考察你对多态的理解。
不过确实如楼上所说,编码不够规范。
想学习的话,去找其他的看看,在回来看这个就能明白了。

这个代码,你可以不看,不符合代码规范,而且错误很多。
一个简单的继承,然后用了static的方法。
没什么实际意义!