Question: My code is:

```
String num;
char n;
char repeat;
String input;

do {

    Scanner keyboard = new Scanner(System.in);
    Scanner in = new Scanner(System.in);
    System.out.println("Enter a binary number: ");
    num = in.nextLine();
    n = num.charAt(0);

    while (n != '1' && n != '0') {
        System.out.println("You did not enter a binary number... try again: ");
        in.next();
    }

    System.out.println("Your binary number is " + Integer.parseInt(num,2));
    System.out.println("Would you like to try again? Y/N");
    input = keyboard.nextLine();
    repeat = input.charAt(0);

} while (repeat == 'y' || repeat == 'Y');

```

I keep getting stuck at "You did not enter a binary number...try again: " even when I enter a binary number what am i doing wrong?

Answer: 
```
  while (n != '1' && n != '0')
    {
        System.out.println("You did not enter a binary number..." +
            "try again: ");
         num = in.next();
         n = num.charAt(0);
    }

```

Do above. You are not updating `n` after getting into loop.
The basic problem is that the while loop condition checks `n`, but `n` is not changed in the loop, meaning that the condition's value never changes.

There is the additional problem that you need to check more than the first character - everything needs to be 0 or 1. Further, you need to ensure that there is a first character to check - the user could enter an empty string.

The easiest way to check this is with a regex: check `num` matches the pattern in the loop condition, and update its value in the loop body if not:

```
while (!num.matches("[01]+")) {
  System.out.println("Enter a valid binary number");
  num = in.nextLine();
}

```