Tuesday, December 28, 2010

Why goto is a keyword in Java?

You can find a lot of discussions about why goto is a keyword in Java and most of them insist that it was added in case goto were to be supported in a later versions. However, the reason is a little bit more down-to-earth - a few know that James Gosling developed the first JVM with goto operator, but later decided to remove it. That's why nowadays compiler is unhappy when you use goto, for example as a variable name.

Source: James Gosling. Q&A session