I have a driven menu class using switch and beside that a class, that class throws an exception when a wrong input is entered how can I got back after the exception and ask the user to input data again.
java class diamond:
public class Diamond
{
private int x;
public Diamond(int x) throws IllegalArgumentException
{
if ((x % 2) == 0)
{
System.out.println("\nx must be odd.");
throw new IllegalArgumentException("x must be odd.");
}
this.x = x;
}