0

some time ago I randomly saw (in a decompiled Java code) something like this:

syntax: {
    //some code
 }

What does this do? And is there more stuff like this? I was not able to find anything about this.

Greetings

2 Answers2

1

I think this is called a label. And can be used with loops. See also using labels in java without "loops"

  • 2
    It's best to include the basic idea of what's in the link, in case that link ever stops working or the page moves. And not only can labels be used with loops - they are almost exclusively used with loops, at least in my experience. – Keara Jan 12 '18 at 09:03
0

Apart from labels if you remove : from start

{ } can be used as init block which is used to write code that will execute as first line in constructor.