Hello,
So I know I can max this program work as intended by switching my nameCheck and ageCheck scanners so that it checks for a string first. I'm just wondering if there anyway to bypass having to put them in order to avoid errors. Obviously when you're coding you don't know when and what order your user will input right?
package com.codegym.task.task04.task0422;
/*
18+
*/
import java.util.Scanner;
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
Scanner ageCheck = new Scanner(System.in);
Scanner nameCheck = new Scanner(System.in);
int age = ageCheck.nextInt();
String name = nameCheck.nextLine();
if (age < 18) {
System.out.println("Grow up a little more");
}//write your code here
}
}