需要输入参数的程序用Eclipse怎么运行?

class NewRoot {
public static void main(String[] arguments) {
int number = 100;
String count = "25";
float sentence = 17.5F;
if(arguments.length > 0) {
number = Integer.parseInt(arguments[0]);
}
System.out.println("The square root of "
+ number
+ " is "
+Math.sqrt(number));
System.out.println(Math.sqrt(Integer.parseInt(count)));
System.out.println("My sentence has been reduced to "
+ sentence + " years.");
}
}
像这样的输入arguments[0],就可以改变输出值,在dos里可以输入java NewRoot 200实现,但是在Eclipse要怎么办才可以呢?
有人说在console里输入,但是我试了一下,console是只读的,不能打字。

哔哔one
浏览 714回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP