• Post Reply Bookmark Topic Watch Topic
  • New Topic

Basic Doubt in Servlet  RSS feed

 
Malli Raman
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is there any difference between Static variable and intance variable (both are int, example given in the Orielly Book).
But since I am using only one instance both are behaving the same. If i user SingleThreadModel only it behaves differently as static is public to all instances and instance variable is for a particular instance only.
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible to have multiple servlet instances even if you are not implementing SingleThreadModel if you have multiple registered names for the same servlet class. In which case, the normal differences between static and instance variables become significant.
-anthony
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!