Scanner reads from a stream. new Scanner(System.in) reads what the user types. nextLine reads one whole line, including spaces. nextInt reads one integer and stops at the first whitespace.
If you call nextInt and then nextLine, the second call can see the leftover newline and return an empty string. After nextInt, either call nextLine once to drain that newline, or read every answer with nextLine and parse it.
Example
nextLine returns the whole sample line. The program then prints it with a label.
import java.util.Scanner;
public class Ask {
public static void main(String[] args) {
Scanner in = new Scanner("Chennai");
String city = in.nextLine();
System.out.println("City: " + city);
in.close();
}
}