The code works for entering wife's name and age, but fails to print the names of sons, though it displays their ages properly.
import java.util.Scanner;
public class Check2
{
    public static void main(String[] args)
    {
    String wife;
    String son1;
    String son2;
    int wifeAge;
    int son1Age;
    int son2Age;
    Scanner keyboard = new Scanner(System.in);
    System.out.println("Wife's name? ");
    wife = keyboard.nextLine();
    System.out.println("Her age? ");
    wifeAge = keyboard.nextInt();
    System.out.println();
    System.out.println("First son's name? ");
    son1 = keyboard.nextLine();
    keyboard.nextLine();
    System.out.println("His age? ");
    son1Age = keyboard.nextInt();
    System.out.println();
    System.out.println("Second son's name? ");
    son2 = keyboard.nextLine();
    keyboard.nextLine();
    System.out.println("His age? ");
    son2Age = keyboard.nextInt();
    System.out.println();
    keyboard.nextLine();
    System.out.println("My wife's name is " + wife + ". She is " +
                       wifeAge + " years old.\nOur first son is " +
                       son1 + ". He is " + son1Age + ".\nOur " +
                       "second son is " + son2 + ". He is " +
                       son2Age + ".");
    }
}
 
     
     
    