I'm trying to stop someone from entering a day number which is less than 0 and greater than 31. Its stuck in an infinite loop.
public void setDay(int setDayTo) throws IllegalArgumentException
{
do
{
if(setDayTo <= 0 || setDayTo >31)
{
System.out.println("Day is not in range from 1 to 31, please" + " " +
"re-enter the date:");
}
// No Exception thrown
day = setDayTo;
}while(day <= 0 || day > 31);
}