I know Maximal Munch Rule isn't Java
specific, but my question only concerns Java
and Java compiler
.
I've also read some of the related answers:
But I'm still not able to fully grasp the concept of Maximal Munch and its applications.
Like in the following code:
int i = 3;
int j = +i;
System.out.println(i); //3
System.out.println(j); //3
How is the statement int j = +i;
interpreted by the Java compiler
and why this works?
Another example, int j = + +i;
also works, but I'm not sure how.
I tried to understand this concept on my own, but I'm not able to.
I would like to know how this works, the concept behind it and how the Java compiler
treats such statements.