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
alukav5142 [94]
4 years ago
5

Assume that processor refers to an object that provides a void method named process that takes no arguments. As it happens, the

process method may throw one of several exceptions. One of these is NumberFormatException, another is FileNotFoundException. And there are others. Write some code that invokes the process method provided by the object associated with processor and arranges matters so that if a NumberFormatException is thrown, the message "Bad Data" is printed to standard output, and if FileNotFoundException. is thrown, the message "Data File Missing" is printed to standard output. If some other Exception is thrown, its associated message is printed out to standard output.
Computers and Technology
1 answer:
jenyasd209 [6]4 years ago
4 0

Answer:

try {        

processor.process();

} catch (NumberFormatException nfe) {  

System.out.println("Bad Data");

} catch (FileNotFoundException fnfe) {

System.out.println("Data File Missing");

} catch (Exception ex) {

System.out.println(ex.getMessage());

}                            

Explanation:

The first statement invokes the process() method. Here process() is the method name and processor is the name of the object.  

try catch statement here is used to catch given exceptions in different catch blocks. When any of these exceptions occur in try block, the corresponding catch block is executed. This catch block is used to handle that particular exception.

In the above chunk of code, if the exception NumberFormatException  is thrown then the message "Bad Data" is displayed in output. The System.out.println() is used to display the message on the output screen. Similarly when the exception FileNotFoundException is thrown  the message "Data File Missing" is printed. The last catch Exception is used when any other exception is thrown and the getMessage() method is called to get the associated message and System.out.println here is used to print that associated message according to the thrown exception.

You might be interested in
Choose two technologies that you think would help the company meet its goals. Then fill in the chart below to compare the techno
elena55 [62]

Answer:

Good luck

Explanation:

Laptop and iPad

laptop because you can open many pages and tabs to help you multitask your goals

and iPad because most free business would be on an iPad and apps are cheap and would help you focus/help you work harder

7 0
3 years ago
Read 2 more answers
Both Wireshark and NetWitness Investigator can be used for packet captures and analysis. Which tool is preferred for each task,
NikAS [45]

Answer:

  • <u>packet capture best suited for Wireshark </u>
  • <u>packet analysis best suited for Netwiness</u>

Explanation:

Although both software packages can carry out each task, however, expert network administrators have noted that in terms of effectiveness, the Wireshark software application is best suited for packet capture since unlike Netwitness has no limitation on the size of files it can capture.

Whereas, because Netwitness has a capacity of up to seven-layer protocol analysis, it can perform a more detailed analysis of packets.

5 0
3 years ago
What is virtualization?
anzhelika [568]

Answer:

Virtualization refers to the act of creating a virtual version of something, including virtual computer hardware platforms, storage devices, and computer network resources.

Explanation:

I hope this was what you were looking for

3 0
3 years ago
Read 2 more answers
The value of a variable can change multiple times during the execution of a computer program.
ratelena [41]

Answer:

a. True

Explanation:

6 0
2 years ago
Which is used on both computers and mobile devices, is the second oldest browser?
Simora [160]
Wouldn't it be Yahoo or Bing?
5 0
3 years ago
Other questions:
  • While trying to solve a network issue, a technician made multiple changes to the current router configuration file. The changes
    7·1 answer
  • The purpose of the ________ element is used to configure the main content of a web page document.
    5·1 answer
  • Two powerboats are about to cross paths. what should the boat on the starboard (right) do?
    11·1 answer
  • To do a good job of searching periodicals at your library, you should use A) the Library of Congress Authorities webpage. B) web
    10·1 answer
  • You have been having issues with your printer, so you decide to learn more about how the printer works. You learn that if you re
    12·1 answer
  • Which of the following is a separate summary worksheet in the same workbook?
    14·1 answer
  • Which practice enables recovery of accidental deletions in data records?
    11·1 answer
  • Type the correct answer in the box. Spell all words correctly. Kenny is designing a document for the employee motivation campaig
    8·1 answer
  • Give 5 characteristics of bad capacitor<br> give 5 characteristics of good capacitor
    10·1 answer
  • 8. When “arc rated” clothing is worn it must allow for what
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!