标签:
package com.mufeng.theeighthchapter; class Meal { public Meal() { // TODO Auto-generated constructor stub System.out.println("Meal()"); } } class Bread { public Bread() { // TODO Auto-generated constructor stub System.out.println("Bread()"); } } class Cheese { public Cheese() { // TODO Auto-generated constructor stub System.out.println("Cheese()"); } } class Lettuce { public Lettuce() { // TODO Auto-generated constructor stub System.out.println("Lettuce()"); } } class Lunch extends Meal { public Lunch() { // TODO Auto-generated constructor stub System.out.println("Lunch()"); } } class PortableLunch extends Lunch { public PortableLunch() { // TODO Auto-generated constructor stub System.out.println("PortableLunch()"); } } public class Sandwich extends PortableLunch { private Bread b = new Bread(); private Cheese c = new Cheese(); private Lettuce l = new Lettuce(); public Sandwich() { // TODO Auto-generated constructor stub System.out.println("Sandwich()"); } public static void main(String[] args) { new Sandwich(); } }
Meal() Lunch() PortableLunch() Bread() Cheese() Lettuce() Sandwich()
标签:
原文地址:http://blog.csdn.net/u013693649/article/details/51860859