Quote:
when the user inputs the same letter that has been guessed before, the program does not decline the "life" value by 1 but instead it keeps it constant
I
don't see an issue here and believe the code would work as intended.
By any chance, are you writing this code in an environment where all inputs have to be made before running program like some fiddle? If so, your program provides 10 chance to guess and if input is not of that length, it would throw an error in
char x = sc.next().charAt(0);
I say this as I have seen such case and error.
Exception in thread "main" java.util.NoSuchElementException
Just to validate, start with less number of chance and see.
BTW, just DEBUG and things would be crystal clear on what's happening and possibly leading to why.