Abhi it's not mandatory to put a semicolon after an anonymous inner class in every case. It's needed if you are creating the anonymous inner class and doing nothing else in the statement. Suppose you write this
new Runnable(){public void run(){}}.run();
Now in this case too you won't write it like this
new Runnable(){public void run(){}};.run();
So basically a semicolon is required if the anonymous inner class creation statement contains only the creation of the anonymous inner class and no method calls.
(Now I know that the code that I wrote will not start a new
thread so don't remind me that :lol: )