Dear all,
Options 2 and 4 is correct.
B'coz,
1. We can not define method in Scriplet (between <% and %>

b'coz Scriplet code always goes to _jspService() method as it is.
And java is not allowing us to define a method in one method it self.
Where as, when we declare a variable or method between <%! and %> (JSP Declarations), it would be added to class which extends HttpJspBase class and not in a method.
So, Options 1 and 5 r wrong.
2. Whereas Page directive is to inform Jsp Engine about page properties. And Directives r predefined so the option 3 is wrong.
3. Now, comes to 2nd and 4th option:
2nd is true b'coz it is the way how we define a java method in our class. (here it is a class who extends HttpJspBase class while translation)
In the 4th option an additional ; is there, and we all know semicolon is mean to a complete statement in JAVA. Here in our example the semicolon would be added in a class which we can always do.
Hope, i m clear enough.
Best Regards, Dharmin
[ January 28, 2003: Message edited by: Dharmin Desai ]