wood burning stoves 2.0*
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
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: class and instance?