前尘远 2021-10-02 20:16 采纳率: 90.9%
浏览 20
已结题

输出格式有点问题,能不能帮我看一下

img

img



```java


import java.util.Scanner;
public class IntReceiver {
        int temp;
    public int getValue() {
        Scanner in = new Scanner(System.in);
        System.out.printf("input an integer:");
        temp = in.nextInt();
        while (temp < 0 || temp > 100) {
            System.out.printf("invalid input!");
            temp = in.nextInt();
        }
        return temp;
    }
}
class Test{
    public static void main(String[] args)

    {

        IntReceiver ir = new IntReceiver();

        int value;

        value = ir.getValue();

        System.out.printf("The value is "+value);

    }
}

```

  • 写回答

1条回答 默认 最新

  • [PE]经典八炮 2021-10-02 20:20
    关注

    输出错误提示以后不得再输出一个input an integer吗

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 10月10日
  • 已采纳回答 10月2日
  • 创建了问题 10月2日