Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Declaration of static

 
leela mohan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose i declare static method in servletclass in that method i want print "hi" it is possible or not ?
static method can also call by classname
so please tell me answer
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes , servletname.methodname()
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nothing will stop you in declaring static methods in servlet class. But what is the need in writing static method in servlet? can you explain us little bit about your requirement?
 
Chaitanya Devavarapu
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do it absolutely.
But, why need to declare a static method in servlet.
If you can tell your exact requirement, I can choose an appropriate
solution.

bye.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can hit yourself in the middle of the forehead with a ball-peen hammer too.

Static methods have their uses, but you have not explained why you would want to do this. Chances are there are better means.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic