Source of Question30.java


  1: //Question30.java
  2: //Solution to Self-Test Question 30, page 93, Chapter 2.
  3: 
  4: import java.util.Scanner;
  5: 
  6: public class Question30
  7: {
  8:     public static void main(String[] args)
  9:     {
 10:         Scanner keyboard = new Scanner(System.in);
 11: 
 12:         String word1, word2, word3;
 13: 
 14:         System.out.println("Type three words on one line:");
 15:         word1 = keyboard.next();
 16:         word2 = keyboard.next();
 17:         word3 = keyboard.next();
 18: 
 19:         System.out.println("You typed the words");
 20:         System.out.println(word1 + "  " + word2 +
 21:                                    "  " + word3);
 22:     }
 23: }