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
What was the first portable computer called and who made it?
jekas [21]
It was the Osborne 1 made by Adam Osborne in 1981.
6 0
3 years ago
The while loop is also known as what kind of a loop? entry-control loop operational loop infinite loop user-control loop
Alexxx [7]
Entry control loop. Because a while loop can be infinite or not based on whether Boolean given is T or F. So we need to know the preexisting condition before we can solve it.
7 0
2 years ago
True/False - According to CP-14 Sale of Modular Homes, a licensee who sells land and a modular home to be affixed to the land, t
Natasha_Volkova [10]

Answer:

True - According to CP- Sale of Modular Homes , a licensee who sells land and a modular home to be affixed to the land is subject to the laws and rules of the Commission,

Explanation:

CP-14 Scale of Modular Homes is a Commission that offers service by Licensees. Such Services such as a collection of rents ,development services,management of real property performed independently but not involving renting. These services are integrated with the real state. All money received in connection disbursed according to the law and the rules of Real Estate.

The Commission is a position is Real State, which stated that licensee who sells land modular homes to be affixed to the land to the purchaser in arranged and pre-arranged packaged transaction is subject to the laws and rules of Commission. All money received should be processed through a broker. It is another position of the Commission that of licensee sells a land, a modular home, and there has no brokerage relationship between owners of the land and licensee, then such sale will not comply with requirements of Commission Rule.

5 0
3 years ago
Pascual specializes in fixing computers. He gets great personal satisfaction out of spending hours working on them, and he has a
Nataly_w [17]

Answer:

expert

Explanation:

Based on the information provided within the question it can be said that the Pascual would be considered an expert on computers. In developmental terms, this refers to someone that has a deep understanding in a particular field as well as the skills and experience needed through lots of practice and education in that specific field. Which in this case is computer hardware.

8 0
4 years ago
Anna discovers malware on her computer. After being downloaded, the malware self-activated and replicated itself and infected th
Tresset [83]

Answer:

A.

Explanation:

The malware that replicates itself and can infect the entire system is a worm.

A worm is a type of malware that gets self-activated and replicated. This worm spreads rapidly over the computer system and can corrupt all the files and the entire system.

A worm is a standalone application and does not require action from humans.

Therefore, option A is correct.

6 0
3 years ago
Other questions:
  • Please help?!
    11·2 answers
  • What makes Group Policy such a powerful tool is its ability to enable security administrators to:_________.
    8·1 answer
  • When Amy turns on her computer, she notices a burning smell. Smoke comes out of the case, and Amy immediately turns off her comp
    7·1 answer
  • The cost of large ground based telescopes has remained the same since the 1800's costing the equivalent of about a billion dolla
    9·1 answer
  • The version of Windows that first provided networking capabilities was _____.
    12·2 answers
  • What is batch processing?
    12·1 answer
  • What is an advantage of a computer network ? networked
    13·2 answers
  • Jenny is working on a laptop computer and notices that the computer is not running very fast. She looks and realizes that the la
    14·1 answer
  • ______________ is a raw fact about a person or an object
    6·1 answer
  • If a user wants to change one small section of the formatting of a document and leave the rest the same, which
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!