while running below program i'm not getting desired input . if i take b =2 i only able to read 1 input. response is like
Enter verifying number: 2 Enter a string: Enter a string: 11
import java.util.*;
class A { public static void main(String[] args) { int b;
Scanner in = new Scanner(System.in);
System.out.println("Enter verifying number: ");
b = in.nextInt();
String s[] = new String[b];
`for (int i=0; i<b; i++)
{`
System.out.println("Enter a string: ");
s[i] = in.nextLine();
} } }
Aucun commentaire:
Enregistrer un commentaire