I'm trying to create a username which contains the last 2 digits of the person's birth year, but it says an int can't be dereferenced. What would be the int version of id.charAt()
? This is a section of my code.
Scanner by = new Scanner (System.in);
System.out.println ("Please enter your birth year:");
int byear = by.nextInt();
if (byear >= 2008){
//the next 2 lines are what I'm having problems with:
char yeara = byear.charAt(2);
char yearb = byear.charAt(3);
//the 2 lines above ^^^
} else {
System.out.println ("Sorry, you're too young to use this website");
}