How do I check if scanner input is blank and assign a variable to the blank string? Overwriting the initial String?
Tried the following code and it does not work.
System.out.print("Username: ");
String username = sc.nextLine();
int u1nameLength = username.length();
if (u1nameLength == 0) {
String username = "Dude"; //generate replacement username
}
System.out.print("Phone Number: ");
String phoneNumber = sc.nextLine();