The user inputs their first name, then their exam mark. I am wanting to check if the mark of this student is already recorded, if it is then I will ask if they want to overwrite this. Should I be using something along the lines of this?:
No. Marks are not the keys of the map, they're the values. If you want to see whether a student already have a mark, you have to check the map if it already contains their name as a key. Also, you need to negative your logic: Even if you replaced mark with name, you would be checking whether the map does NOT contain the name.
You should check the input == "Y" condition inside the if-statement above it.
Finally, don't declare variables before you need them, and use try-with-resources to close your resources when you're done with them.
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
you should check the input == "Y" condition inside the if-statement above it.
This is an incorrect comparison. The variable `input` is of type char, so should be compared to 'Y', not "Y".
And if it were of type String, comparing using == is still incorrect.
And note that `input` is not in scope outside of the if-block.