这是一个初学者的问题.我试图从带有参数的cmd运行java程序.这是我的班级:
public class Test{
public static void main(String[] args){
System.out.println("This is a test");
System.out.println(args.length);
}
}
Run Code Online (Sandbox Code Playgroud)
我可以成功运行它而不需要参数.如何在程序中添加示例5和6作为参数?
我发现所有其他答案只是运行程序.我已经知道该怎么做了.我无法找到如何使用参数运行程序.
我是Java编程新手.我正在尝试编写一个程序来计算数字13的前400个倍数,并将它们存储在一个带有整数的数组中.我无法找到为什么这堂课有两个错误,我想我没有犯过任何错误.有人可以帮忙吗?第一个错误(此行上有三个错误)打开
System.out.println("the first 400 multiples of 13:" );
Run Code Online (Sandbox Code Playgroud)
令牌";"上的语法错误,{在此令牌之后的预期令牌上的
语法错误""13的前400个倍数:"",
在令牌上删除此令牌语法错误,错放的构造(s)
而第二个是在最后}
在哪里说:
语法错误,插入"}"以完成ClassBody
public class multiples_of_13 {
int[] thirteens = new int[400];
int numFound = 0;
// candidate: the number that might be a multiple
// of 13
int candidate = 1;
System.out.println("the first 400 multiples of 13:" );
while (numFound < 400) {
if (candidate % 13 == 0) {
thirteens[numFound] = candidate;
numFound++;
}
candidate++;
}
System.out.println("First 400 multiples of 13:");
for (int i = 0; i …Run Code Online (Sandbox Code Playgroud)