标题:求助,这个程序的运行结果是什么啊?
取消只看楼主
whliveyb
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-12-22
结帖率:0
 问题点数:0 回复次数:0 
求助,这个程序的运行结果是什么啊?
class Meal {
  Meal() { System.out.println("Meal()"); }
}

class Bread {
  Bread() { System.out.println("Bread()"); }
}

class Cheese {
  Cheese() { System.out.println("Cheese()"); }
}

class Lettuce {
  Lettuce() { System.out.println("Lettuce()"); }
}

class Lunch extends Meal {
  Lunch() { System.out.println("Lunch()");}
}

class PortableLunch extends Lunch {
  PortableLunch() {
    System.out.println("PortableLunch()");
  }
}

public class Sandwich extends PortableLunch {
  Bread b = new Bread();
  Cheese c = new Cheese();
  Lettuce l = new Lettuce();
  Sandwich() {
    System.out.println("Sandwich()");
  }
  public static void main(String[] args) {
    new Sandwich();
  }
}
搜索更多相关主题的帖子: class public 
2011-12-23 21:24



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-358490-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.409273 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved