0

When i run following it runs successfully :

import java.util.*;
public class god {
    public void main() {
        int chalnabey;
        Scanner in=new Scanner(System.in);
        System.out.println("t");
    }
}

But when i add another line to assign input to variable, the left side red loader goes non-stop progressing and my code never runs !

import java.util.*;
public class god {
    public void main() {
        int chalnabey;
        Scanner in=new Scanner(System.in);
        chalnabey=in.nextInt();               //This is addition line to previous code
        System.out.println("t");
    }
}

Can anybody tell why this happens and how to correct it ?

4

1 回答 1

0

您的代码正在等待来自键盘的输入

chalnabey = in.nextInt();

打开 BlueJ 终端窗口(从 BlueJ 主菜单,单击查看 > 显示终端),您将看到光标闪烁。输入任何文本并按下Enter,您的程序将继续执行。

于 2013-05-22T23:26:16.993 回答