import java.util.*; /** * SimpleWithInput.java * * Another really simple Java program, this time accepting input, and * using the input data as part of the output. * * Notice the import statement on the first line of this file; we have * to import the definitions of the Scanner class in order to use them * below. * * David Liben-Nowell * CS117, Spring 2006 */ public class SimpleWithInput { /** * The main method for this class. Prompts the user for input * (two names) and prints out a message to the console. */ public static void main(String[] args) { String name1; String name2; Scanner input = new Scanner(System.in); System.out.println("What is your name?"); name1 = input.next(); System.out.println("What is your partner's name?"); name2 = input.next(); /** * Look at the next two lines carefully, paying close attention * to what's inside the quotation marks and what's outside. */ System.out.println("I hope you like coffee, " + name1 + " and " + name2 + "!"); } }