Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( a ) Consider the following classes: public class Bird { public int sp 2 ( Object o , Bird b ) { return 1
a Consider the following classes:
public class Bird
public int spObject o
Bird
b
return ;
protected double spBird b
return ;
int spjavautil.Scanner s
return ;
private boolean spint i
return true;
public int spObject o
String s
return ohashCode;
public int spString s
Object oreturn
;
public class Jay extends Bird
public int spString
String y
return ;
private int spdouble d
return ;
boolean spJay j long i
return true;
protected long spJay j int i
return ;
public int spObject sp
Bird breturn ;
List the method signatures of methods named sp that are made available by
the public interface of class Jay.
b You are told by your boss to add runtime error checking to your code. When is
it better to throw an exception, and when is it better to use an assert statement?
For both cases, give a suitable example and explain why the chosen approach is
more appropriate for the example.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started