| Author |
JSP declaration
|
Bala MuraliKrishna
Greenhorn
Joined: Mar 31, 2005
Posts: 2
|
|
The following question is there in one of the mock exam in jdiscuss. I have verified the output and the output is aaabbb. <html> <body> <% String a = "aaa"; %> <%! String a = "AAA"; %> <%! String b = "BBB"; %> <% String b = "bbb"; %> <% out.println(a+b); %> </body> </html> some one please explain me the logic behind this scenario. Bala SCJP Dream Java!
|
 |
Bala MuraliKrishna
Greenhorn
Joined: Mar 31, 2005
Posts: 2
|
|
Sorry for the above code which was modified by me while evaluating the output. Please refer below given code. Sorry for the inconvenience caused. <html> <body> <% String a = "aaa"; %> <%! String a = "AAA"; %> <% String b = "bbb"; %> <%! String b = "BBB"; %> <% out.println(a+b); %> </body> </html> Thanks Bala SCJP Dream Java!
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
The best way to figure out what is going on is to have a look at the Java servlet that the container will create on behalf of your JSP page. This is perhaps the most instructive thing you can do to find out why JSPs behave the way that they do. For Tomcat, the Java files are written to the folder hierarchy at $CATALINA_HOME/work.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: JSP declaration
|
|
|