I have tried to follow this and read around but I have a simple question..
I call method getIntField and return the value or exception, but I want to test that return.. If the value returned was not valid how to I trap and test that?
Method called...
[code=java]
public int getIntField() {
try {
return Integer.parseIn t( searchStk.getTe xt());
} catch (NumberFormatEx ception e) {
message.setText ("" + searchStk.getTe xt() +"INVALID or wrong stock nbr, please re-enter...");
return 0;
}
}
[/code]
I want to know what happened before I display the rest of my screen.
Thanks!
I call method getIntField and return the value or exception, but I want to test that return.. If the value returned was not valid how to I trap and test that?
Method called...
[code=java]
public int getIntField() {
try {
return Integer.parseIn t( searchStk.getTe xt());
} catch (NumberFormatEx ception e) {
message.setText ("" + searchStk.getTe xt() +"INVALID or wrong stock nbr, please re-enter...");
return 0;
}
}
[/code]
I want to know what happened before I display the rest of my screen.
Thanks!
Comment