2017-05-08 73 views
-4
import java.util.*; 
class Example { 
    public static void main(String args[]) { 
     Scanner input = new Scanner(System.in); 
     System.out.print("number of rooms:"); 
     int rooms = input.nextInt(); 
     int count = 0; 
     for(int i = 0; i < rooms; i++) { 
      System.out.print("room capacity-q:"); 
      int q = input.nextInt(); 
      System.out.print("current space of the room-p:"); 
      int p = input.nextInt(); 
      if ((q - p) >= 2) { 
       count += 1; 
      } 
     } 
     System.out.println("no.rooms for thusitha & chamod is:"+count); 
    } 
} 

我收到了一個錯誤,稱爲class not found。想知道這是什麼原因。在java中找不到class命令的錯誤消息

+3

找不到哪一個類?它可能是一個錯字嗎?還是錯過了進口? – n247s

+0

請告訴我們錯誤。 –

+0

我正在運行此代碼沒有任何錯誤... – dat3450

回答

0

該代碼運行完美;不會導致這樣的錯誤。 如果你能提供你得到的錯誤的詳細信息會更好。

雖然我沒有看到任何地方是錯的。 您的代碼中沒有美學或錯字錯誤。 它給出了關於輸入掃描器未關閉的警告;這可以暫時忽略。

相關問題