MCQs>IT & Programming>JSP And Servlets> Given the following code from a servlet, and given that myvar is a reference to either an HttpSession or a ServletContext: 1. myVar.setAttribute(“myName”, “myVal”); 2. String s = (String) myVar.getAttribute(“myName”); // more code After line 2 executes, which is true?
JSP And Servlets MCQs
Given the following code from a servlet, and given that myvar is a reference to either an HttpSession or a ServletContext: 1. myVar.setAttribute(“myName”, “myVal”); 2. String s = (String) myVar.getAttribute(“myName”); // more code After line 2 executes, which is true?
Answer
Correct Answer: The value of s cannot be guaranteed
Explanation:
Note: This Question is unanswered, help us to find answer for this one