My actual question is as follows:
In C++ nested parameters are required to have a space in between, like List< List<String> >. This is done such that the compiler can differentiate between the above and a bit shift >>. But the same thing is not true for Java List<List<String>> is perfectly valid. How does the JVM differentiate between the above and >> bit shift?
The difference is in the context that surrounds the supposed >> operator. When it is an operator, an expression is expected for both operands:
An expression can be a variable, a literal, a function invokation, or a complex combination of all those elements. While in the case of a list declaration, however, there are no expressions involved, just types and id’s. For example:
Actually, in the new standard the C++ compiler is able to make the difference as well.