Create a program accept input from the keyboard


Discuss the below:

Q: Generally, word processing programs can count and then display the number of characters in a document, either including or excluding blank characters. Using methods from the String class, write a program that will accept input from the keyboard and then display three values:

1) The count of all characters in the string, including leading and trailing blanks.

2) The count of characters excluding leading and trailing blanks.

3) The count of all non-blank characters.

The program should continue as long as the user enters any values, even if only spaces are entered. Figure 9-49 (attached to post) displays sample output from the program.

1961_Output of code.jpg

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Create a program accept input from the keyboard
Reference No:- TGS01935187

Now Priced at $20 (50% Discount)

Recommended (95%)

Rated (4.7/5)