Import the Java. Util. Scanner;
Public class Exom05 {
Public static void main (String [] args) {
String STR=new String [] [20].
Int m;
Scanner sc=new Scanner (System. In);
System. The out. Print (" input password number n: ");
Int n=sc. NextInt ();
for(int i=0; I & lt; n; I++)
{System. Out. Println (" input password first "+ (I + 1) +" ");
STR [I]=sc. NextLine ();
}
System. The out. Print (" password ");
String str2=new String (sc) nextLine ());
M=0;
For (int I=0; I
If (str2. The contains (STR) [I]) m=1;
}
If (m==1) System. Out. Print (" input password right ");
The else System. Out. Print (" password incorrect ");
}
}
CodePudding user response:
In the int n=sc. NextInt (); After added sc. NextLine ();//remove residues in the input buffer after receive the int data enter a newline characterCodePudding user response: