Computer Science, asked by thrig0799, 9 months ago

Write a java program to accept a sentence and display the words in the sentence separately sample input:We are in cyber world
Sample output:We
Are
In
Cyber
World

Answers

Answered by pammykr679
0

Answer:

To extract the words, we will first create a Scanner object out of the sentence variable which holds our user input string. The Scanner separates tokens by a whitespace. Essentially, each word in the sentence is now a scanner token. We will run a while loop using the Scanner.

Similar questions