Well...
If it's code in a question, leave it. That's their convention, but you can point out the appropriate conventions in a comment, or even in an answer to their question.
If it's code in an answer, it depends. If you're only modifying the answer to be more readable with respect to modern Java conventions, and you don't change any of the logic itself, then it's an edit I'd be okay with. Although, I'd also strongly encourage you to find more stuff to edit, too.
If the code is the only thing you edit...please don't. If there are other glaring typos in the actual answer, then fix those too.