Java – why don’t these semicolons produce errors?

See English answer > what is the use of an empty statement (not for loop) in Java? [closed] 6

public class Main{
    public static void main(String[] args){
        System.out.println("blah blah blah and stuff")
    }
}
System.out.println("blah blah blah and stuff");;
public class Main{;;;;;;
    public static void main(String[] args){;;;;;;;;
        System.out.println("blah blah blah and stuff");;;;;;
    };;;;;;
};;;;;

Solution

This is called empty statement, which is valid@ H_ 419_ 8@

while (checkCondition()) // may have some side effects
    ;
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>