I've done a simple program that allows user to enter a name and then greets him.

```
import java.util.Scanner;
public class nameinput {
    public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    System.out.println("Enter a name: (only letters, at least 2 characters long)");
        while (true) {
            String name= sc.next();
            if (name.length() < 2){
                System.out.println("This name is too short!");
                continue;
            }
            else if (!name.matches("[a-zA-Z]+")){
                System.out.println("Letters only!");
                continue;
            }
            else {
                System.out.println("Hello, " + name);
                break;
            }
        }
    }
}

```

However I have two issues I can't solve:

1. When user inputs a name containing a space, it only gets what's before space.
2. When user passes only a series of spaces, or doesn't pass anything, nothing happens, like he didn't type anything. I'd the user to receive a proper message informing him that the spaces-only strings and empty strings are not allowed.

I hope I was clear in descriptions of problems, thanks in advance for any help!