this is not working and I cannot figure out why
do {
System.out.println("enter your work email");
workEmail = scnr.nextLine();
if (workEmail.substring(workEmail.length() - 4) != ".") {
System.out.println("Please enter a valid email. example: JohnDoe@yahoo.com");
}
} while (workEmail.substring(workEmail.length() - 4) != ".");
workEmail.endsWith(".com")
– YCF_L Dec 3 '19 at 9:56workEmail.substring(workEmail.length() - 4)
will return a String that you have to compare for equality using equals: e.G.if(workEmail.substring(workEmail.length() - 4).equals(".com"))
– OH GOD SPIDERS Dec 3 '19 at 9:59