my dog learned polymorphism*
The moose likes Servlets and the fly likes Declaration of static Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Declaration of static" Watch "Declaration of static" New topic
Author

Declaration of static

leela mohan
Greenhorn

Joined: Oct 31, 2006
Posts: 13
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

Joined: Nov 29, 2005
Posts: 2308
yes , servletname.methodname()


Rahul Bhattacharjee
LinkedIn - Blog
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

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?


Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
Chaitanya Devavarapu
Greenhorn

Joined: Dec 06, 2006
Posts: 19
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

Joined: Jan 10, 2002
Posts: 60050
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Declaration of static
 
Similar Threads
Static Variable Problem
static string
static / non-static method overriding
Static methods - overriding
what did i break? "no main method found"