While I am working with eclipse ID then I suddenly found that I put double semicolon in variable declaration.
Below is my statement
double defaultValue = 0.0;;
I am getting confused here. I expected the above statement throw an exception but I wrong above statement run without any error.
Why double semicolon not showing any error?
It's an empty statement, that's all. It's perfectly legal, though usually useless. It's specified in section 14.6 of the JLS:
An empty statement does nothing.
EmptyStatement:
;Execution of an empty statement always completes normally.
Just about the only time I've ever actually seen it used is to give a loop an empty body, e.g.
while (somethingWithSideEffects())
;
Personally I'd prefer to use braces in that case (or change the code to not use side effects in that way), but that's a matter of personal preference.
See more on this question at Stackoverflow