簡體   English   中英

Eclipse不運行靜態主類

[英]Eclipse does not run the the static main class

我使用了https://www.codingame.com的chrome插件( codin game Sync ),將一個類下載到了我的Eclipse Version: Luna Service Release 2 (4.4.2) Windows 8.1 Enteprise ,這是一個非常簡單的類:

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 / main-> java

域名codin.com上只有一個選項卡打開

我懷疑您的應用程序正在運行,但您不知道它:)請執行以下操作:

    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");

如果您在控制台中看到消息“ Hello App” ,則該應用程序正在運行,等待您輸入一些整數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM