File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes to define methods as static or not Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "to define methods as static or not" Watch "to define methods as static or not" New topic
Author

to define methods as static or not

peter brews
Greenhorn

Joined: Feb 11, 2002
Posts: 20
Following is the program that I wrote for Socket client.
In method2 of the program i am instantiating the class MyClass
and then calling all the methods as <obj>.<methodname> in this method. This method2 will be called with different params .
Could you please advise me if it is possible/better if instead of instatiating the class i make all those methods as static.

(edited by Cindy to format code)
[ April 11, 2002: Message edited by: Cindy Glass ]
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
If you make them static then you have to watch your synchronization. But WHY would you do either?
If someone called this class, why don't you just use the "this" instance to call the methods?


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: to define methods as static or not