Question

In: Computer Science

1 .RuntimeException class is a subclass of the Exception class. Fill in the blanks to complete...

1 .RuntimeException class is a subclass of the Exception class. Fill in the blanks to complete the declaration of the RuntimeException class. _____________   ________________    _________________

.

.

.

3. RuntimeException is a subclass of Exception. The constructor RuntimeException(String message) calls the parent class's constructor with the message argument. Which of the following makes the call correctly?

this(message);

super(message);

super.Exception(message);

Exception(message);

4. RuntimeException has overloaded constructors: the 1-argument constructor RuntimeException(String message) and the 2-argument constructor RuntimeException(String message, Throwable cause).

The 2-argument constructor calls the 1argument constructor with message as the argument. Which of the following makes the call correctly?

this(message);

RuntimeException(message);

this.RuntimeException(message);

5. RuntimeException is a sublcass of Exception. Both classes have a constructor that takes a String argument. Among the statements below, indicate all that are syntactically correct.

Exception e = new Exception("Division by zero problem");

Exception e = new RuntimeException("Division by zero problem");

RuntimeException e = new Exception("Division by zero problem");

RuntimeException e = new RuntimeException("Division by zero problem");

6. Payable is an interface with one method payableAmount() that returns double.

(1) The source code of the interface is saved in a file named ____________java

(2) Fill in the blanks to complete code for the interface:

public ____________________ Payable {

public abstract _______________payableAmount();

}

7. The Student class implements the Payable interface without actually implementing the only payableAmount() method declared in the interface. Fill in the blanks to complete the declaration of the Student class:

public _________ class   __________      ___________         __________

8. SQLException is unchecked exception, hence handling such exception is optional.

True

False

9. An abstract class can have constructors even though it cannot be instantiated.

True

False

10. In Java, a class can implement more than one interface.

True

False

Solutions

Expert Solution


1.

public class RuntimeException extends Exception{

   /**

   *

   */

   private static final long serialVersionUID = 1L;

  

   public RuntimeException(String message) {

       // TODO Auto-generated constructor stub

       super(message);

   }

  

  

   public RuntimeException(String message, Throwable t) {

       // TODO Auto-generated constructor stub

       this(message);

  

}

}

3.super(message);

4.this(message);
5..RuntimeException e = new RuntimeException("Division by zero problem")

6. Payable is an interface with one method payableAmount() that returns double.

(1) The source code of the interface is saved in a file named Payable.java

(2) Fill in the blanks to complete code for the interface:

public interface Payable {

public abstract _____double payableAmount();

}

7. The Student class implements the Payable interface without actually implementing the only payableAmount() method declared in the interface. Fill in the blanks to complete the declaration of the Student class:

public abstract class   Student      implements Payable

8. SQLException is unchecked exception, hence handling such exception is optional.

True [Like Runtime also]

9. An abstract class can have constructors even though it cannot be instantiated.

True

10. In Java, a class can implement more than one interface.

True


Related Solutions

Fill in the blanks to complete the following table.
Fill in the blanks to complete the following table.SymbolIon FormedNumber of Electrons in IonNumber of Protons in IonF__________9Te_____54_____II−_______________Mg2+_____12Part AComplete the first column of the table.Express your answer as a chemical symbol.Part BComplete the second column of the table.Express your answer as ions. Enter your answers in order given in the table, from top to bottom, separated by a comma.Part CComplete the third column of the table.Express your answer as integers. Enter your answers in order given in the table, from...
Java Modify subclass HourlyEmployee11 and class HourlyExc (created to hold the exception) to add a "try...
Java Modify subclass HourlyEmployee11 and class HourlyExc (created to hold the exception) to add a "try and catch" statement to catch an exception if "empStatus == 1" hourly wage is not between $15.00/hr. and $25.00/hr. The keywords “throw” and “throws” MUST be used correctly and both keywords can be used either in a constructor or in a method. If an exception is thrown, the program code should prompt the user for the valid input and read it in. *NOTE*- I...
Fill-In-The-Blanks 13. Complete the code by filling in the blanks for each question below. (Length of...
Fill-In-The-Blanks 13. Complete the code by filling in the blanks for each question below. (Length of blank doesn’t matter.) a) Print out the contents of the array airlines. #include #include ________________ using namespace std; int main () { string airlines[] = {"american","pan-am","southwest"}; for (int i = 0;_______________;i++) cout << ____________ << endl; return 0; } b) Read in 5 integers from the user and write them back out in reverse order int numbers[5]; for(int i = 0; ___________; _________) cin...
Fill in the blanks in the paragraph below to complete a description of mutants and mutations...
Fill in the blanks in the paragraph below to complete a description of mutants and mutations In DNA, a Blank 1 mutation can result from the expected sequence CCG being coded instead as CTG. As a result of this change, the resulting m-RNA codon would be GAC instead of Blank 2. Consequently, this will result in an amino acid of Blank 3 instead of Blank 4. Since the amino acids are Blank 5, the mutation can definitely be ruled out...
C++ Fill in the blanks please You are required to fill in the blanks in this...
C++ Fill in the blanks please You are required to fill in the blanks in this program. Consider that: -In main, the variables price and quantity were given the names of p (double) and q (int), respectively. -In the getData function, the parameters associated with the main variables p and q were called pp and pq, respectively. // Prototype: Do not include the names // of the variables in the prototype void getData (FILLTHEBLANK , FILLTHEBLANK); int main () {...
JAVA CODE FILL IN THE BLANKS you are to complete the skeleton program by completing *...
JAVA CODE FILL IN THE BLANKS you are to complete the skeleton program by completing * the To Do sections. I would suggest doing this a * little bit at a time and testing each step before you * go on to the next step. * *           Add whatever code is necessary to complete this assignment *********************************************************************/ //Add whatever code is necessary to complete this assignment public class Methods {    public static void main(String[] args)    {...
Fill in the blanks with numbers to complete the following equivalences 1._ km=_m 2. _um=_m
Fill in the blanks with numbers to complete the following equivalences 1._ km=_m 2. _um=_m
1)    Fill in the blanks to complete Whole Food’s Income Statement ($ millions). WHOLE FOODS Income...
1)    Fill in the blanks to complete Whole Food’s Income Statement ($ millions). WHOLE FOODS Income Statement For Year Ended September 25, 2016 Sales $15,724 Cost of goods sold and occupancy costs            ? Gross profit $ 5,411 Operating expenses            ? Operating income $     857 2) )   Fill in the blanks to complete Whole Food’s Balance Sheet ($ millions). Whole Foods Balance Sheet September 25, 2016 Cash $   351 Current liabilities $   1,341 Non-cash assets ? Long-term liabilities ?...
Fill in the blanks: Consider the following equilibrium and fill in the blanks with either increase...
Fill in the blanks: Consider the following equilibrium and fill in the blanks with either increase or decrease. I2(s) + 5F2(g) ⇌ 2IF5(g) A decrease in volume results in a Blank 1 in pressure which will Blank 2 the amount of IF5.
Fill in the blanks to complete the following statements. Bold left parenthesis a right parenthesis(a) For...
Fill in the blanks to complete the following statements. Bold left parenthesis a right parenthesis(a) For the shape of the distribution of the sample proportion to be approximately​ normal, it is required that ​np(1minus−​p)greater than or equals≥​______. Bold left parenthesis b right parenthesis(b) Suppose the proportion of a population that has a certain characteristic is 0.10.1. The mean of the sampling distribution of ModifyingAbove p with caretp from this population is mu Subscript ModifyingAbove p with caretμpequals=​______. ​(This is a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT