1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ainat [17]
3 years ago
9

Assume inputFile is a Scanner object used to read data from a text file that contains a number of lines. Each line contains an a

rbitrary number of words, with at least one word per line. Select an expression to complete the following code segment, which prints the last word in each line. while (inputFile.hasNextLine()) { String word = ""; String line = inputFile.nextLine(); Scanner words = new Scanner(line); while (_________________) { word = words.next(); } System.out.println(word); }
Computers and Technology
1 answer:
anzhelika [568]3 years ago
7 0

Answer:

words.hasNext()

Explanation:

Given the code snippet below:

  1.        while (inputFile.hasNextLine()) {
  2.            String word = "";
  3.            String line = inputFile.nextLine();
  4.            Scanner words = new Scanner(line);
  5.            while (words.hasNext()) {
  6.                word = words.next();
  7.            }
  8.            System.out.println(word); }
  9.    }

We have a inputFile Scanner object that can read data from a text file and we presume the inputFile has read several rows of data from the text file. So long as there is another line of input data available, the outer while loop will keep running. In each outer loop, one line of data will be read and assign to line variable (Line 3). Next, there is another Scanner object, words, which will take the current line of data as input. To get the last word of that line, we can use hasNext() method. This method will always return true if there is another tokens in its input. So the inner while loop will keep running so long as there is a token in current line of data and assign the current token to word variable. The word will hold the last token of current line of data upon exit from the inner loop. Then we can print the output (Line 8) which is the last word of the current line of data.

You might be interested in
This OS was created by a developer named Torvalds.
GREYUIT [131]
The answer to this problem is Linux
7 0
3 years ago
You have probably heard of wearable fitness devices, such as FitBit. What new products do you think might exist in this field in
tino4ka555 [31]

The new products in this fitness field in a decade are:

  • TRX Home2 System.
  • Rogue Rubber Coated Kettlebells.
  • Stamina Adjustable Kettle Versa-Bell, etc.

<h3>What is the use of artificial intelligence in fitness?</h3>

AI is known to be in the field of wellness and also fitness as it has made product such as:

  • GOFA Fitness that uses GPS.
  • 3D motion tracking technology.
  • Machine learning to give users with live feedback when in a workouts, etc.

Therefore, The new products in this fitness field in a decade are:

  • TRX Home2 System.
  • Rogue Rubber Coated Kettlebells.
  • Stamina Adjustable Kettle Versa-Bell, etc.

Learn more about fitness from

brainly.com/question/1365564

#SPJ1

5 0
2 years ago
Where is the spell checker found in excel?
fenix001 [56]
Except keyboard of F7 and Spell Checkbutton in toolbar, you are also able to apply Spelling check command fromExcel 2007/2010/2013/2016 Ribbon: Click the Review tab; Go to Proofing group; Then you will view the Spellingbutton , that's Spell Check command.



hope this helps
5 0
3 years ago
Read 2 more answers
Who can answer me this one plss little urgent
olga nikolaevna [1]

Answer:

C is the answer mostly I guess

3 0
2 years ago
Engineers perform a(n) blank to compare the possible negative effects of making a decision involving technology with the possibl
Bumek [7]

Answer: Experiment.

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Climate is considered a(n) _______ limiting factor. (2 points)
    9·1 answer
  • Which of the following is the strongest password? Xo795&amp;A &amp;cGo9Tz F5h#3u9g vU7#$3T sC9$d&amp;cF5h#3u9g
    13·2 answers
  • If you are unsure about what is or isn’t appropriate to wear to a new job, what is the best thing to do?
    13·2 answers
  • What is processing requirement in computer?
    11·1 answer
  • What games do you play?<br><br><br> Be sure not to report any answers!
    5·1 answer
  • Assume there are two variables, k and m, each already associated with a positive integer value and further assume that k's value
    13·1 answer
  • The Freeze Panes feature would be most helpful for which situation?
    6·1 answer
  • For each problem listed below, use the drop-down menu to select the field of the professional who can help solve the issue.
    7·2 answers
  • When the user types into a Textbox control, the text is stored in the control's __________ property.
    6·1 answer
  • Show that ALLDFA is in <img src="https://tex.z-dn.net/?f=%5Cmathrm%7BP%7D" id="TexFormula1" title="\mathrm{P}" alt="\mathrm{P}"
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!