File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes 'class level or 'static' getters and setters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " Watch " New topic
Author

'class level or 'static' getters and setters

Mathew Lee
Ranch Hand

Joined: Jun 08, 2009
Posts: 238
Hi,
I would like to know about
'class level or 'static' getters and setters ' in java beans. What are they how and where they are used. Any links, ideas, resources, sample code highly appreciated. Thanks in advance.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

why you want setter and getter for static members (class level members) ?what is your requirement ?
Mathew Lee
Ranch Hand

Joined: Jun 08, 2009
Posts: 238
Hi,

I just want to know about them due to curiosity. Thanks in advance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

Sure, you can create them for class-level variables. What else do you need to know?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sandeep Swaminathan
Ranch Hand

Joined: Apr 23, 2008
Posts: 52
I presume you're confused with the difference between "class level", "static" & "getter & setters".
If you declare your method to be static, then you can use the method in another class without the need of creating any instance for it.



A static variable can also be accessed in the same way.
Getter & Setters methods are basically used for private variables to be used in another class using the methods and not the variables as such.
Hope it helps!


Music is all around us. All you have to do is just LISTEN to it,
Sandeep Swaminathan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 'class level or 'static' getters and setters