Hi Pawan,
Hope you got this code from my exam simulator,
ExamLab (Question no: 54 in Diagnostic exam)
There is a built-in explanation available for this question in the simulator software, didn't you read it?
Anyway, please read and understand the copyright rule in JavaRanch. According to this rule, you CAN copy and paste a question here, but you must specify the location where did you copy it from.
Now it's ok, but please follow this rule, when you post a question again.
Note: All of the questions and explanations in this simulator were copywritten.