public class SecondScannerExercise
1:
2: import java.util.*;
3:
4: public class SecondScannerExercise
5: {
6: public static void main(String[] args)
7: {
8: Scanner keyboard = new Scanner(System.in);
9:
10: String word1, word2, word3;
11:
12: System.out.println( "Enter a line of text with three words:");
13: word1 = keyboard.next( );
14: word2 = keyboard.next( );
15: word3 = keyboard.next( );
16:
17: System.out.println( "With space corrected, you entered:");
18: System.out.println(word1 + " " + word2 + " " + word3);
19: }
20: }