Question: What is output? public class BaggageWeight { static void baggageWeight ( int weight ) { boolean value = false; try { while ( ! value

What is output?
public class BaggageWeight {
static void baggageWeight(int weight){
boolean value = false;
try {
while (!value){
if (weight >30){
throw new Exception("Double Max Weight");
}
if (weight >15){
throw new Exception("Excess Weight");
}
value = true;
System.out.println("Accepted");
}
}
catch (Exception excpt){
System.out.println(excpt.getMessage());
}
}
public static void main(String[] args){
baggageWeight(42);
}
}
a.
Accepted
b.
Double Max Weight
Accepted
c.
Double Max Weight
d.
Double Max Weight
Excess Weight

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!