Oop
Oop
import codes.Student;
import java.util.*;
while (true) {
while(true) {
try {
a = Integer.parseInt(scan.nextLine());
break;
} catch (NumberFormatException e) {
System.out.println("Invalid input. Please enter your real Age!");
}
}
}
scan.close();
}
}
package OopTest;
import codes.Student;
import java.util.*;
while (true) {
while(true) {
try {
a = scan.nextInt();
scan.nextLine();
break;
} catch (InputMismatchException e) {
System.out.println("Invalid input. Please enter your real Age!");
scan.nextLine();
}
}
}
scan.close();
}
}