What will be the correct choice ? [code] <%int x=0;%> <% x = x + 1999; %> Set it to: <%= x %> [code] What should be the initial value of x to allow compilation to succeed, and allow the output of "Set it to: 2000"? Ans:A <% int x = 1 %> B <%@ int x = 1 %> C <%! int x = 1 %> D None of the above I think the correct choice should be 'C'. What do u think? Bye,
Poonam Akash,<br />Sun Certified Java Programmer,<br />Sun Certified Web Component Developer.<br />Good luck may be an opportunity that keep the door open,BUT hardwork always keeps the door open!!
Even if its defined <%! int x = 1;%> still the answer will be d(none of the above). Because if you have a varibale defined at the class level and also at method level with the same name and if you access in the method with out this.x it will return the local varibale.
Ramu Kalvakuntla<br />SCJP,SCWCD,IBM Certified Specialist - IBM VisualAge for Java