When would you put a semicolon after a method closing brace?

前端 未结 4 591
轮回少年
轮回少年 2020-12-02 01:43

I\'ve been programming in Java for a while, and I\'ve just come across this syntax for the first time:

public Object getSomething(){return something;}; 
         


        
4条回答
  •  一生所求
    2020-12-02 02:24

    A semicolon is interpreted as an empty statement, which is permissible whereever a statement is permissible.

    EmptyStatement:
     ;
    

    As Java specification says

    http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.6

提交回复
热议问题