aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question Bank ID : 41 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Question Bank ID : 41" Watch "Question Bank ID : 41" New topic
Author

Question Bank ID : 41

Sar Lolla
Greenhorn

Joined: Mar 10, 2005
Posts: 10
Which of the following statements are TRUE (Choose 2).

1) <%! int i; %> is a variable declaration that has object scope within
the servlet.


2) <% int i; %> is a variable declaration that is class scope to the service method.


3) <%! int i; > a variable declaration that has local scope within the
service method of the servlet

4) <% int i = 0; %> is a variable declaration that has local scope within the service method of the servlet.

The mock test is giving the answers as 1 and 4. Why? what is the meaning of object scope?

Can some one please help me? I marked 2 and 4 as answers.
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3211
    
    6
Howdy

1)



will be converted at JSP translation time to:



which is object scope (global scope)


4)



will be converted at JSP translation time to:



which is local scope (method scope)

NOTE, you can have both :


and


in the same JSP - one variable will shadow another

regards,
MZ


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question Bank ID : 41