subject

Java Exercise : Word/Line Count
The GNU/Linux operating system comes with many built-in utilities for getting real work done. For example, imagine you had to analyze thousands of files as part of a digital forensics investigation. One utility you might use is the wc command, which prints the newline, word, and byte counts for a given file. For example, if a file contained the text "This is the first line.\nThis is the second.", the wc command would print 1 9 43 (i. e., 1 newline character, 9 words, 43 total characters).

For this exercise, you will implement a similar utility. Create a new class named WordCount that has a single method named analyze that takes a string parameter named text and returns an array of three integers. This method should count the number of newlines, words, and characters in the given string. (The return value is an array of these three counts.) Note that a "word" is any sequence of characters separated by whitespace.

Hint: You can use a Scanner to count the number of words in a string. The Scanner. next() method returns the next word, ignoring whitespace.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
When building customer relationships through email what should you not do? question 2 options: utilize proper grammar, spelling, and punctuation type in all capital letters use hyperlinks rather than attachments respond to all emails within 24 hours
Answers: 1
question
Computers and Technology, 23.06.2019 08:00
Which argument is not a valid filter? does not equal this quarter filter by cell color all of these are valid filter arguments.
Answers: 2
question
Computers and Technology, 23.06.2019 23:30
The keyboard usually has six rows of keys. which of the following is not one of the key group categories? letter keys number keys control keys graphic keys
Answers: 1
question
Computers and Technology, 24.06.2019 15:00
Universal windows platform is designed for which windows 10 version?
Answers: 1
You know the right answer?
Java Exercise : Word/Line Count
The GNU/Linux operating system comes with many built-in utilit...
Questions
question
Mathematics, 15.10.2019 22:30
question
Mathematics, 15.10.2019 22:30
Questions on the website: 13722360