为什么运行不了啊
来源:2-5 编程练习
眼睛眯起来
2020-03-16 00:16:43
import java.util.Scanner;
public class ScoreAssess {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y;
if(x<0)
System.out.println("y = "+(y=-1));
else if(x==0)
System.out.println("y = "+(y=0));
else
System.out.println("y = "+(y=1));
1回答
好帮手慕阿慧
2020-03-16
同学你好,程序运行没有问题,我们可以在sc.nextInt();之前打印一条语句提示用户输入。
修改如下:
运行如下:
如果我的回答解决了你的疑惑,请采纳!祝学习愉快!
相似问题