In the Java Generic Book, while contrasting the difference between C++ Templates and Java Generic says:
In C++, a problem arises because >>
without the space denotes the
right-shift operator. Java fixes the
problem by a trick in the grammar.)
What is this trick?
This is actually being fixed in C++ in the next version. There really isn’t much of a trick; if you encounter >> while in the process of parsing a generic or template where instead you expected >, then you already have enough information to generate an error message. And, if you have enough information to generate an error message, you also have enough information to interpret >> as two separate tokens: > followed by >.