This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am surprised how a topic which is not used at all in the Java world could ignite such a discussion. In OCPJP, labels are there only for the questions with labelled break. Application wise, labels are never used at all. This is a migration from C's jump statements.
Also Shalini, Gaurang's code is correct
This code runs and outputs the String inside the println.
The error is due to improper ending(without the semicolon) which actually makes the the closing bracket as a statement which is clearly an error and this is stated very specifically when you do a javac on the class file.
[ SCJP 6.0 - 90% ] , JSP, Servlets and Learning EJB.
Try out the programs using a TextEditor. Textpad - Java 6 api