How to take multiple string input in java using a scanner?
class MyClass {
public static void main(String[ ] args) {
Scanner a = new Scanner(System.in);
//Scanner b = new Scanner(System.in);
System.out.println (a.nextLine());
System.out.println(a.nextLine());
}
}
Then type this way:
a
b
🔗Reference : stackoverflow.com
🔗Source: Java Interview Questions and Answers
🔗Reference: Javatpoint.com