I am aware that semicolons are required to end statements, as in this piece of code:
public class Main{
public static void main(String[] args){
System.out.println("blah blah blah and stuff")
}
}
A semicolon is required at the end of the println statement, or else the program won't compile.
Recently, I accidentally placed two semicolons at the end of the println statement:
System.out.println("blah blah blah and stuff");;
I noticed it, so I began to place semicolons everywhere in my program
public class Main{;;;;;;
public static void main(String[] args){;;;;;;;;
System.out.println("blah blah blah and stuff");;;;;;
};;;;;;
};;;;;
This code compiles, prints the string, with no errors or unexpected results. I have searched about why the compiler appears to have simply ignored these semicolons, but never found anything that specifically mentions this. So, why are these semicolons not producing a syntax error?