import java.util.Scanner;
public class Hello {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int a;
String s;
System.out.println("Enter int : ");
a = in.nextInt();
System.out.println("Enter String : ");
s = in.nextLine();
System.out.println("int : "+a+"\nString : "+s);
}
}
I'm a completely beginner of Java. I made the class Hello
and want to enter one number and one string but I think s = in.nextLine();
this line is ignored. How can I enter two values line by line.