Where is the String value which is taken from user allocated in the memory?
Scanner input = new Scanner(System.in);
String x = "hello"; // This is stored in String constant pool
String y = "hello";
String z = new String("hello"); // This is stored in normal heap
System.out.println("Enter "+x);
String u = input.next(); // Where is this stored?
System.out.println(x==y) // true because same memory address in SCP
System.out.println(x==z) // false because one is stored in SCP and other in heap
System.out.println(u==x) // false then not in SCP
System.out.println(u==z) // false then not in heap either
is the value u stored in Stack then?