Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static blocks in servlels

 
manasa teja
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometime back, somewhere, I read that, we are not supposed to use static blocks in servvlets. Is it because, teh static blocks gets executed during initiaon.
Can someone explain the reason with example.
ram
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know of no reason to avoid static initialization blocks in servlets and I have used them occasionally.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic