importjava.util.*;publicclasstext{Stringname;intcj;publicstaticvoidmain(String[]args){Scannerinput=newScanner(System.in);text[]a=newtext[2];a[0]=newtext();a[0].name=input...
import java.util.*;
public class text {
String name;
int cj;
public static void main(String[] args){
Scanner input=new Scanner(System.in);
text[] a=new text[2];
a[0]=new text();
a[0].name=input.nextLine();
a[0].cj=input.nextInt();
a[1]=new text();
a[1].name=input.nextLine();
a[1].cj=input.nextInt();
System.out.println(a[0].name+" "+a[0].cj);
}
}
最后会输出
ss
55
ss
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Scanner.java:864)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at text.main(text.java:13)
好像是输入的数据不符合。。怎么回事大佬们
好像是输入的数据不
展开