Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
for(int i = 1 ; i <= n; i++)
{
System.out.println(i);
}
String name = scn.nextLine();
System.out.println("Hey " + name);
So, this is my code and as we know name variable contains "\n" but the ouput is showing something else. According to the logic there should be two enter hits as I have used System.out.println() and name contains "\n" but after observing the ouput, there is only one enter hit. Can anyone please address why there is one enter hit if name contains "\n"? This question is different from the skipping concept