Hi I'm newbie in Java and I have to write a code which simulate logging to bank account and I want to allow user to press enter key to continue after "inserting" card instead of pressing alphabetic key
public class Main
{
public static void main (String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("If you inserted card press y");
String p = sc.nextLine();
boolean tak;
if (p.charAt(0) == 'Y' || p.charAt(0) == 'y')
tak = true;
else
tak = false;
Loginning l = new Loginning(tak);
}
}
Also after pressing enter 'tak' boolean needs to return true like in the if statement