+ 1
How to read data from keyboard for strings
I tried read more than two names from keyboard and I want to access those names again please can anyone explain me
4 Answers
+ 1
Hi, you need to assign you input read to variables.
Example:
Scanner s = new Scanner(System.in);
String name1= s.NextLine();
String name2= s.NextLine();
+ 1
thanku and I have one doubt will we can do this using arrays concept
0
take Scanner class
scan.next();
0
just declare an array and use for loop to keep getting input from user until the size of array