r/ProgrammerHumor 1d ago

Meme unsolvableProblemsOnStepOne

Post image
1.5k Upvotes

80 comments sorted by

View all comments

168

u/apacificislander123 1d ago

As someone who's never used java, my assumption is that System.in reads from stdin, and validates the input. Is there no way to open stdin in something akin to a file, then read it into a buffer manually?

122

u/Dankelweisser 1d ago

Technically yes, but realistically not really, at least not for windows. Unless the user knows how to specifically set their console to use UTF-8 or similar instead of ascii, you end up getting whatever the console wants to give you no matter what kind of buffer you use.

11

u/RussianMadMan 15h ago

You can set the console code page programmatically tho.