خرید بک لینک

Vote count: 0

I know this might seem like a simple/silly question, but I am trying to keep my code as organized and simple as possible. The problem that I am having is with a while loop for validation. I am validating a string input. I am using the validation simply to make sure that something is entered. The only time I would like the while loop to run is when no information is entered at all, so I would like to include every character and symbol. The question that I have, is that I am wondering if there is a shorter way to include every character possible except for simply hitting enter of course. Here is the simple code snippet.

Scaer input = new Scaer(System.in);
PrintWriter out = new PrintWriter("contactRequest.txt");


System.out.print("Please enter your name: ");
String email = input.nextLine();
while(!email.matches("[a-zA-Z]+"));
{
    System.out.println("nPlease enter a valid E-Mail.");
        email = input.nextLine();
}
out.println("E-Mail: " + email);

asked 34 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 19 تير 1395 ساعت: 13:58

صفحه بندی