2017-01-23 6 views
0

のクラスをダウンロードするには、https://www.codingame.comのクロムプラグイン(codin game Sync)を使用しました。 Windows 8.1 Enteprise、それは非常に単純なクラスです:Eclipseは静的メインクラスを実行しません

class Player { 

    public static void main(String args[]) { 
     Scanner in = new Scanner(System.in); 
     int W = in.nextInt(); // width of the building. 
     int H = in.nextInt(); // height of the building. 
     int N = in.nextInt(); // maximum number of turns before game over. 
     int X0 = in.nextInt(); 
     int Y0 = in.nextInt(); 
     System.out.println("0 0"); 
     // game loop 
     while (true) { 
      String bombDir = in.next(); // the direction of the bombs from batman's current location (U, UR, R, DR, D, DL, L or UL) 

      // Write an action using System.out.println() 
      // To debug: System.err.println("Debug messages..."); 


      // the location of the next window Batman should jump to. 
      System.out.println("0 0"); 
     } 
    } 
} 

しかし、それは私のコンソールには何も印刷されません。

ポイント:

私は、ビルド・パスにクラスを追加するために使用されるが、それはまだ何も印刷されませんが、プロジェクトを実行します。

プロジェクトを右クリック - >プロパティ - > Javaのビルド・パス - >タブのソース - 選択>プロジェクト名/ SRC /メーン> javaの

ドメインに1つだけ開き、タブがありcodin.com

+5

これは、 'System.in'であなたからのいくつかの入力をスキャンしています。あなたは何かを提供していますか?入力として5つの整数を指定する必要があります。 –

+0

あなたのJavaプログラムでCtrl + F11を試してみてください! – Darshit

+0

それは私のために働く。あなたはコンソールに何かを入力していますか?それ以外の場合、in.m'nextInt()は永遠に待機します。 – GAlexMES

答えて

0

私はあなたのアプリケーションが動作している疑いがあるが、あなたはそれに気づいていない:) はこれを行います。

Scanner in = new Scanner(System.in); 
    System.out.println("Hello App"); 
    int W = in.nextInt(); // width of the building. 
    int H = in.nextInt(); // height of the building. 
    int N = in.nextInt(); // maximum number of turns before game over. 
    int X0 = in.nextInt(); 
    int Y0 = in.nextInt(); 
    System.out.println("0 0"); 

コンソールにメッセージ「こんにちはアプリケーション」を見るならば、アプリはちょうどWAを実行しています

+1

あなたの答えを完了するには、もちろんこれが機能します。 'CodinGame'は入力を使ってアルゴリズムを書くことを尋ねるだけで、' run'クリックで自動的に入力のリストを提供します。ここでは、日食では、それらの入力はユーザーから来る、OPはおそらくそれを取得していない。 – AxelH

関連する問題