我已经阅读了一些有关类似问题的问答,但他们没有解决我的问题。
我有下一个java文件:
public static void main(){
System.out.println("\n9. Create a program that wap 2 numbers (interchange them).");
int aa;
int bb;
int aux;
Scanner scanC = new Scanner(System.in);
System.out.println("First number: " );
aa = scanC.nextInt();
System.out.println("Second number: " );
bb = scanC.nextInt();
System.out.println("Initial: " + "\n" + aa + "\n" + bb);
aux = aa;
aa = bb;
bb = aux;
System.out.println("Interchanged: " + "\n" + aa + "\n" + bb);
}
当我运行它时,它不会带来任何输出。我只是在此之前最后一次运行 java 文件的输出(我在 Eclipse 中保持多个打开的 java 文件)。 我尝试修改运行配置,并关闭并重新打开 Eclipse。依然没有。 请帮忙
最佳答案
main
方法的签名不会使其成为 main
方法的单一入口点。
将签名更改为:
public static void main(String[] args)
...或...
public static void main(String... args)
如果需要的话,将该类设置为您的项目主类。
关于java - 我在控制台中没有输出 - java - Eclipse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27128714/