zyy266
发贴: 7
积分: 0
|
于 2004-09-27 09:50
import java.io.*; class Elevator{ boolean running = true; void shutDown(){ running = false; } class FrontDesk{ private final int EVENING = 8; Elevator NorthElevator, SouthElevator; FrontDesk() { NorthElevator = new Elevator(); SouthElevator = new Elevator(); } void maintenance(int time){ if(time==EVENING) NorthElevator.shutDown(); } void displayStatus(){ System.out.print("North Elevator is "); if(!(NorthElevator.running)) System.out.print("not"); System.out.println("running."); System.out.print("South Elevator is "); if(!(SouthElevator.running)) System.out.print("not"); System.out.println("running."); } } } public class Hotel{ public static void main(String args[]){ FrontDesk lobby; lobby = new FrontDesk(); System.out.print("It's 7:00 tTime to check the "); lobby.maintenance(7); lobby.displayStatus(); System.out.println(); System.out.println("It's 8:00 Time to cheack the "); lobby.maintenance( 8 ); lobby.displayStatus(); } }
这个程序编译出错 显示 D:\rabbit\java\exercise\Hotel.java:35: cannot resolve symbol symbol : class FrontDesk location: class Hotel FrontDesk lobby; ^ D:\rabbit\java\exercise\Hotel.java:36: cannot resolve symbol symbol : class FrontDesk location: class Hotel lobby = new FrontDesk();
难道这里定义方法有错?
|