• Post Reply Bookmark Topic Watch Topic
  • New Topic

class variable and method variable  RSS feed

 
subhit chauhan
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my class i have to declare a variable. Should i declare it at class lever or method level. and Why?
Is their any security reasons in this?
 
Prasath Thirumoorthy
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi it would be better if ur ? is more specific.Access of a variable depends on it access specifier.If u need the variable in many places means it is better to declare as class variable and if u need in only some specific method means u declare it as method variable/local variable

with regards
prasath

"If there is any mistake, plz correct me"
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!