Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes class and instance? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class and instance?" Watch "class and instance?" New topic
Author

class and instance?

raymond yadao
Ranch Hand

Joined: Jan 29, 2001
Posts: 88
I'm just want to know if what's the difference of class methods and instance method? When to use class methods or instance methods?
thanks!

raymond
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Use instance methods if the result or side-effects depend on the state or contents of the object. Use class methods if the result depends only on its arguments or on other "static" data.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
raymond yadao
Ranch Hand

Joined: Jan 29, 2001
Posts: 88
Originally posted by Frank Carver:
Use instance methods if the result or side-effects depend on the state or contents of the object. Use class methods if the result depends only on its arguments or on other "static" data.

can you elaborate further or give an examples?
raymond
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
OK.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: class and instance?
 
Similar Threads
methods (class and instance)
Lock on hidden and hiding static method.
abstract class and "this"
Static and Non static Synchronized methods
Two sync methods of same class called by two threads