Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the classes below, what is the output of the following program execution: Ablic class BadCharException extends Exception public BadCharException (String message) (super message); }

image text in transcribed
Given the classes below, what is the output of the following program execution: Ablic class BadCharException extends Exception public BadCharException (String message) (super message); } public class Test Names public static void main(String[] args) String[] names ("one","two", "three"); BadCharException problem new BadcharException ("x"); tryd for (String name: names) if (name.charAt(0) -t') throw problems System.out.print (name.charAt(0)); catch (BadCharException e) { System.out.print(e.getMessage(): catch(Exception e) { System.out.print("y")) b. xox e None of the above 9. Given the following code, what is the output? public class Figure public void display System.out.print("Figure"); public class Line extends Figure! public void display System.out.print("Line); public class Inherit public static void tryme (Figure ) ( f.display(); } public static void main(String! ] args) { Figure f = new Figure ); Line In- new Line(); fon; tryme (f); a Line b. Figure c. FigureLine d. Compilation error e. None of the above b nclusive i in the o very 10. Why does the code in the following method represent an infinite recursion? public int infinite Recursion(int n) [ if (n > 0) return infinite Recursion (n) + 1; else return 0; a. Because there is no base case b. Because the recursive call does not move the parameter closer to the base case c. Because the recursive call moves the problem further away from the base case d. Because there is no recursive call e. None of the above

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

More Books

Students also viewed these Databases questions

Question

Describe briefly the steps used to develop a forecasting system.

Answered: 1 week ago

Question

recognise typical interviewer errors and explain how to avoid them

Answered: 1 week ago

Question

identify and evaluate a range of recruitment and selection methods

Answered: 1 week ago

Question

understand the role of competencies and a competency framework

Answered: 1 week ago