Can someone help me with this little bug I found?
So, I'm working on a simple project on Java. I'm creating basically a Banking program. It's really simple. I'm just practicing and trying to work my way to figure things out. For today, I think what I want to try to figure out is how to have the program keep asking the user for a valid name until the user enters a valid name. So, I tried doing this and I'll just put in an empty name, it'll put me back but when I do it again, it'll let me in. How do I prevent that from happening? I know there's tons of improvement I need to implement on this program, but I'm just wanting to deal with this one thing I found. I'll improve it some more tomorrow. Here is what I wrote: //Bank Account project // The purpose of this is to store account information like balance and to make simple transactions such as deposit and withdraws. /* Improvements that I'll add in: * Put balance number with randomized account number in a file and read file every time program runs * Add in a password and validate the password before allowing the user to perform transactions * Add support for more than one account */ import java.util.Scanner; public class Bank { public static void main(String[] args){ Scanner input = new Scanner(System.in); //scanner int input_num = -1; double deposit_num = 0; // number of how much money to deposit double withdraw_num = 0;// number of how much money to withdraw String account_name = " "; while (account_name == " "){ //This block of code will have the program ask the user to enter a name until it enters a valid name System.out.print("Enter your account name: "); account_name = input.nextLine(); Account a = new Account(account_name); System.out.println(" "); //This code needs to improvement. The program takes in invalid names as the account name. Needs tweaking. } Account a = new Account(account_name); System.out.println(" "); System.out.println("Welcome " + account_name + ". You have a total balance of
quot; + a.getBalance());