ONE D Question 8 1 pt The Java compiler requires that your program handle type of exceptions. Checked. Fatal. O Regulate
Posted: Sun May 15, 2022 1:50 pm
ONE D Question 8 1 pt The Java compiler requires that your program handle type of exceptions. Checked. Fatal. O Regulated. Severe. D Question 9 1 pts You are designing your own exception type, and wish to handle an exception that the programmer could have prevented. Which of the following statements is the approach recommended by the textbook? The exception should be a checked exception and should extend the RuntimeException class or one of its subclasses. The exception should be an unchecked exception and should extend the RuntimeException class or one of its subclasses. The exception should be a checked exception and should extend the error class or one of its subclasses. The exception should be an unchecked exception and should extend the Error class or one of its subclasses.
Question 10 Consider the following code snippet: Scanner in = new Scanner(.. double value - in.nextDouble(); > If there is no number appearing next in the input, what will occur? value will contain a null value. If hasNextDouble() = false, no code is run, value is null or zero value will contain a zero. An Invalidcast exception will occur. O A NoSuchelementException will occur. Question 11 Consider the following code snippet: Printwriter out = new Printwriter("output.txt"); Which of the following statements about the printwriter object is correct? If a file named "output.txt" already exists, an exception will occur. If a file named "output.txt" already exists, data will be added at the end of the file. If a file named "output.txt" already exists, existing data will be deleted before data is added to the file. If a file named "output.txt" already exists, a new file named "output_1.txt" will be created and used
Question 10 Consider the following code snippet: Scanner in = new Scanner(.. double value - in.nextDouble(); > If there is no number appearing next in the input, what will occur? value will contain a null value. If hasNextDouble() = false, no code is run, value is null or zero value will contain a zero. An Invalidcast exception will occur. O A NoSuchelementException will occur. Question 11 Consider the following code snippet: Printwriter out = new Printwriter("output.txt"); Which of the following statements about the printwriter object is correct? If a file named "output.txt" already exists, an exception will occur. If a file named "output.txt" already exists, data will be added at the end of the file. If a file named "output.txt" already exists, existing data will be deleted before data is added to the file. If a file named "output.txt" already exists, a new file named "output_1.txt" will be created and used