wood burning stoves
The moose likes Beginning Java and the fly likes Static Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Static Objects

Joseph Cho
Ranch Hand

Joined: Feb 19, 2012
Posts: 44
What is the best way to go about making a static class?

I know in C# you just declare the class static.. but In Java you cannot unless it's a subclass correct?

Also, if I declare a static reference to a class. I'm trying to wrap my head around this.. Does this mean whatever object the reference is pointed to, no matter what outside class makes an instance of the class holding the static object of another class.. it will always retain the same variables for that static class instance?
Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

Duplicate. Locking.
I agree. Here's the link: http://aspose.com/file-tools
subject: Static Objects
It's not a secret anymore!