Compiler doesn't complain when I ended a line with two semicolons. Why?

后端 未结 7 2177
不思量自难忘°
不思量自难忘° 2021-01-19 01:29

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

7条回答
  •  盖世英雄少女心
    2021-01-19 02:11

    Compiler wont complain even when you just create an empty file with .java extension. Its an empty compilation unit and its valid. Same way a semicolon is an empty statement which is valid.

提交回复
热议问题