要求的output:
Enter greeting message:
Here are some shapes
Here are some shapes
但是我在输入的时候只要一输入“Here are some shapes”下面得output就会出现红字并且没有output。
红字是这些:
Exception in thread "main" java.util.InputMismatchException at java.base/java.util.Scanner.throwFor(Scanner.java:939) at java.base/java.util.Scanner.next(Scanner.java:1594) at java.base/java.util.Scanner.nextInt(Scanner.java:2258) at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
这是我的代码:
public static void main(String[] args){
System.out.println("Enter greeting message");
Scanner scan = new Scanner(System.in);
int input = scan.nextInt();
System.out.println(input);
能有大佬告诉我缺了什么步骤吗,初学真的不太明白。