![]() |
JBridge: Certification Question Of The Day |
| JBridge Home >> Certification Questions >> Question for Tuesday May 13th 2003 | Tuesday May 13th 2003 |
|
Examine the following JSP code, then identify which variables and objects are threadsafe: (5 correct answers)
<%! int counterA = 0; %>
<% Integer tempInt = (Integer) session.getAttribute("counterB");
int counterB = tempInt.intValue(); %>
<% int counterC = 0; %>
<% int counterDD = incrementCounter(0); %>
<%! private int incrementCounter(int counterD) {
return counterD ++;
}
%>
<%! static int counterE = 0; %>
A counterA B counterB C counterC D counterD E counterDD F counterE G tempInt H The object held as attribute "counterB" by the session. Page down for the answer... The AnswerAnswers B, C, D, E and G are correct. counterB, counterC, counterDD and tempInt are local variables within the jsp's service method, while counter D is a method parameter. Both types of variable are thread safe. |
EMail: dbridgewater@jbridge.co.uk
Phone: +44 (0)1943 877414
Fax: +44 (0)1943 877414
Mail: David Bridgewater, Willow Dene, Bradford Road, Menston, Ilkley, West Yorkshire, LS29 6ED, UK
Copyright © 2003 David Bridgewater. All rights reserved.