It's because nextInt() doesn't consume the newline character in the input stream. Try this:

import java.util.*;
public class Oldest {
public static void main(String[] args) {
Scanner stdin =...