aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes can a variable with same name present in more than one scope? 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 "can a variable with same name present in more than one scope? " Watch "can a variable with same name present in more than one scope? " New topic
Author

can a variable with same name present in more than one scope?

yamini nadella
Ranch Hand

Joined: Apr 13, 2004
Posts: 257
can a variable with same name present in more than one scope?
assume first I declared a variable in page scope and then I declared the same variable in application scope then what happens?
arnel nicolas
Ranch Hand

Joined: Dec 16, 2003
Posts: 149
My guess is YES, but should be in a different scope.

arnel
Ashish Sarin
author
Ranch Hand

Joined: Nov 20, 2000
Posts: 432
    
    5
Yes it is possible. But it is recommended that you try not to have variables with same name in different scopes. If you do have such a case in which variable with the same name is present in lets say, page and session scopes then when the EL expression is used which requires rearching the various scopes then it will return the variable in the scope which was searched first ie. page.


Author of
Getting started with Spring Framework
Portlets in Action
Spring Roo 1.1 Cookbook
Portlets blogSpring Roo blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can a variable with same name present in more than one scope?