import java.util.*; public static void main(String[] args) { } Enter something
public class Input {
Scanner s=new Scanner(System.in);
System.out.println("Enter something");
int a=s.nextInt();
System.out.println("The thing entered is:"+a);
Scanner w=new Scanner(System.in);
System.out.println("Now enter a string");
String q=s.nextLine();
System.out.println("The entered String is:"+q);
}
**In the above program the output is:
54
The thing entered is:54
Now enter a string
The entered String is:
**can I get the explanation for this behaviour
Don’t press enter before entering the string input. On pressing enter, the string entered in the new line will not be taken as input and hence the input is taken as blank.