Question: ( 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
