This is my code:
public boolean SetYear (String year)
{
if (year.matches("[0-9]{4}"))
{
_year=year;
return true;
}
return false;
}
Instead of return false I want to make a runtime error with my massage. Something like "the value must be 4 digits"
How can I do it?