Javas Eclipse无法显示控制台程序

时间:2016-05-13 20:05:40

标签: java

我不知道如何设置Eclispe IDE ...我已经安装了acm.jar但是当我点击Run按钮时会弹出Applet View窗口但是程序没有被执行。我错过了什么?

import acm.program.*;
import acm.graphics.*;

public class proba extends ConsoleProgram {

    public void run() {

        for (int x = 99; x == 0; x--) {
            println(x + " bottles of beer on the wall");
            println(x + " bottles of the beer");
            println("You take one down, pass it around"); 
        }
    }
}

2 个答案:

答案 0 :(得分:0)

这是如何设置eclipse IDE https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/set-up-the-eclipse-ide-for-windows

Code Shoud是这样的因为如果你想在java上显示一些内容你应该使用System.out.println / print

public void run(){

for (int x = 99; x == 0; x--) {
    System.out.println(x + " bottles of beer on the wall");
    System.out.println(x + " bottles of the beer");
    System.out.println("You take one down, pass it around"); 
}

}

答案 1 :(得分:0)

程序可能执行得太快,你看不到它。

为什么这么快,你问?因为循环没有做任何事情。

for (int x = 99; x == 0; x--) {

x = 99
x == 0吗?的 没有
完成!