It's because, for some bizarre reason, the author of the Java syntax file that comes with Vim decided that all C++ keywords that aren't also Java keywords (e.g. `register`, `delete`, `virtual`, etc.) should be highlighted as errors in Java buffers. The only reason I can think of for doing that is that if you happen to be a C++ programmer who is learning Java, you might accidentally start writing C++ in the middle of your Java code since the syntax of the two languages is somewhat similar. Still, it's a really boneheaded thing to include in the default Java syntax highlighting, and I'm surprised more people don't complain about it.
When I encountered the same problem myself, I read the syntax script and discovered that if you put `let java_allow_cpp_keywords = 1` in your .vimrc, it will stop this silly behavior. That's probably the easiest thing for you to do. Long term, it would be better if this feature were removed altogether, or at least disabled by default.
pgpLTd07CzOqo.pgp
Description: PGP signature
