Write a java program to ask user to input four lines. Your program will store the four lines in a String array (create a
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Write a java program to ask user to input four lines. Your program will store the four lines in a String array (create a
Write a java program to ask user to input four lines. Your program will store the four lines in a String array (create a String array of size 4). Once the input is complete, your program will output the total number of words in the String array and print all words on a separate line. PS: Use StringTokenizer class to count and print tokens. A sample output of the program is given below. Input any four lines Enter line 1: Twinkle, twinkle, little star, Enter line 2: How I wonder what you are! Enter line 3: Up above the world so high, Enter line 4: Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond in the sky. Total words in 4 lines: 22