Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: What is the difference between variable declared inside a declaration and variable declared in scriplet?
Answer: Variable declared inside declaration part is treated as a instance variable and will be placed directly at class level in the generated servlet.
<%! int k = 10; %>
Variable declared in a scriptlet will be placed inside _jspService() method of generated servlet.It acts as local variable.
<%
int k = 10;
%>
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook