【发布时间】:2015-02-21 01:38:01
【问题描述】:
问题是当我尝试在 Eclipse 中查看编程结果时,我无法拥有控制台窗口,但是当我运行代码以确保没有出错时,那里什么也没有出现,这是我尝试的代码运行它
package com.java24hours;
public class NewRoot {
public static void main(String[] args) {
int number = 100;
if (args.length > 0) {
number = Integer.parseInt(args[0]);
System.out.println(" The square root of "
+ number
+ " is "
+ Math.sqrt(number));
}
}
}
【问题讨论】:
-
确保您提供了 args 的值
-
右击你正在运行的类,然后点击属性,在窗口打开的时候点击运行/调试设置,然后点击Main方法,点击编辑,然后在参数选项卡上,输入您想要平方根的数字。
-
if (args.length > 0)- 如果您在 Eclipse 中的运行配置不提供参数,您将看不到任何输出。
标签: java eclipse console output