I thought bad thing would happen when I ended a line like this. But compiler didn\'t even complain. Does anybody have an idea, why this is legal in java.
displ
It's an empty statement and is valid. As pointed out by jwodder, to be more precise the empty statement is the lack of statement between the two semicolon and could be represented by two consecutive semicolons or by semicolons separated by white space (that is including new lines).
IDE like Eclipse will warn you about this. If you check the picture below, I've inserted a double semicolon on line 236. The red lines were added by me to focus the attention, but Eclipse give many visual cues: