Hey, Can i know how to do the throw and catch for my java code ? i need to create a OfferException class which allow a suitable error message to be specified when there is an error.
this is my code..
public boolean makeOffer(int offerPrice)
if (!super.getSaleStatus())
{
System.out.println("Error - Property Sale is closed!");
return false;
}
else if(offerPrice <= super.getCurrentOffer())
{
System.out.println("Error - New offer must be higher than current offer!");
return false;
}
else
{
super.setCurrentOffer(offerPrice);
//do something
return true;
}
}