import java.util.Scanner; /** * Illustrates: * - Creating variables of type Scanner and String * - Using the dot operator * - Calling the nextLine(), nextInt() and nextBoolean() method * * @author alchambers * @version 2015 */ public class Interview { public static void main(String[] args){ Scanner in = new Scanner(System.in); System.out.println("What's your name?"); String name = in.nextLine(); System.out.println("What's your favorite number?"); int favoriteNum = in.nextInt(); System.out.println("Do you like dogs? (Type \"true\" or \"false\")"); boolean likesDogs = in.nextBoolean(); System.out.println(); System.out.println("We are honored to have joining us today, the distinguished " + name + "."); System.out.println("We were able to sit down with " + name + " today and ask some deep questions:"); System.out.println("\tWe found out that " + name + "'s favorite number is " + favoriteNum + "."); System.out.println("\tWe were also pleased to be able to confirm the rumors:"); System.out.println("\tIt is " + likesDogs + " that " + name + " likes dogs!"); System.out.println(name + ", thank you again for joining us!"); } }