Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- Counts the number of words in a line.
- Input: a string containing the line
- Output: the number of words in the line
- public class CountWords
- {
- public static void main(String[] args)
- {
- // your work here
- Scanner in = new Scanner(System.in);
- while (in.hasNext())
- {
- // more work here
- }
- // more work here
- }
- }
Add Comment
Please, Sign In to add comment