Reserved words as names or identifiers

 picture · Jan 8, 2009 · Viewed 18.4k times · Source

Is there any tricky way to use Java reserved words as variable, method, class, interface, package, or enum constant names?

Answer

Rob Kennedy picture Rob Kennedy · Jan 8, 2009

This is a valid question. Such a thing is possible in other languages. In C#, prefix the identifier with @ (as asked before); in Delphi, prefix with &. But Java offers no such feature (partly because it doesn't really need to interact with identifiers defined by other languages the way the .Net world does).