Question
Java Based Programming. Create an application class called Text with the following tasks for its main method: static void main(String[] args) - Asks for a
Java Based Programming.
Create an application class called Text with the following tasks for its main method: static void main(String[] args) - Asks for a sentence and stores it in a string object. Then creates a StringBuilder object to store that string.
- Removes any blank spaces after and before the input text.
- Removes any extra blank spaces between the words in the input text.
- Counts the number of words in the input text.
- Shows the trimmed text and the number of words.
Note: You should use trim, indexOf, charAt, and deleteCharAt methods.
Sample Output
Enter a text: Characters are the fundamental building blocks of Java source programs Trimmed Text: Characters are the fundamental building blocks of Java source programs. Word Count10
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started