section and I can't seem to make the (Y/N) work. I want it to where if the user enters a Y then it goes to (else) and continues the program, but if they enter a N then it takes the 1 which is assigned to "char N = 0" and minus's 1 making it 0, thus making the continueflag false and discontinuing the program.

Enter a value for N
6
The Factorial of 6 is 720
Continue (y/n)?
Enter a value for N
y
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at factorial.main(factorial.java:14)

Re: I'm so lost, trying to disable a loop or continue it on users input

Re: I'm so lost, trying to disable a loop or continue it on users input

First, I would recommend getting rid of the outer while(true) loop. I don't believe you need it. Second, apparently there is still
some residual characters in the input stream from your first use of keyboard.nextInt(). So put a keyboard.nextLine() right after
it and see what happens.

Re: I'm so lost, trying to disable a loop or continue it on users input

Sorry about that. The problem is that when you use Scanner.nextInt(), the user enters this with the "enter" key, which leaves a newline character. You need to "consume" this new line by calling nextLine() right after. Also, you have two while loops, you should only have one in this case. I provided a modified version of your code below.

Also, for the sake of convention, class names are usually CapitalizedCamelCase, and variables are usually lowerCamalCase. This technically doesn't matter, but it may be a tad bit confusing for others reading your code. You seem to most of these switched in your code.