I am running a method that takes a (char,double,char) and returns a double or a string.
I an running into an error when it returns the strings. How can I handle the string and continue the program?
I do have a try catch, and it is catching the string but the program stops.
Thanks a bunch.
All I have of the code,
public class Function
{
public static double shippingCost(char packageType, double weight, char customerType)
{
.................
.................
}
}
*It is not meant to be good design. It is for error testing.
You possibly can return Object from the method (which will allow you to return a String or a Double). In the code where you call this methods, you would then need to detect what type of Object the returned result is, so that you can handle it properly.