Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Example2 {
- public static void main(String args[]) {
- Scanner sc = new Scanner(System.in);
- int age = 0;
- boolean finish = false;
- while (finish == false) {
- System.out.print("Input age:");
- age = sc.nextInt();
- if (age < 0 || age > 120) {
- System.out.println("Invalid");
- } else {
- System.out.println("Good");
- finish = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement