Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java !!!!!! The next four (4) questions are related. They deal with the following declarations: public class Blunder extends Exception { public Blunder(String message) {

Java !!!!!!

The next four (4) questions are related. They deal with the following declarations:

 public class Blunder extends Exception { public Blunder(String message) { super(message); } } 

The method tally may raise a Blunder runtime error. Examine the following code:

 public int getCount() { return gatherer.tally(); } 

1. This code will not compile. Why? (Assume that gatherer exists and the call to tally is valid.)

Here are two suggestions for rewriting getCount. When you rewrite both, you may omit comments.

2. Option 1: Rewrite the method so that the error propagates back to the caller.

3. Option 2: Rewrite the method so that it outputs an error message and returns the value 1.

4. Compare Option 1 and Option 2, commenting on their relative merits, that is, say which option is better and why. (2 5 sentences)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Factory Active Database For Enterprise Computing

Authors: Schur, Stephen

1st Edition

0471558443, 9780471558446

More Books

Students also viewed these Databases questions

Question

In what ways do organisations possess knowledge?

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago

Question

1. Select the job or jobs to be analyzed.

Answered: 1 week ago