Hi all,
I'm fairly new to java and OOP in general so i'm sure there will be a
simple answer to my question, I just can't seem to find anything on
google.
The problem is I have a class called 'Server' and a class called
'ServerConfiguration', along with several other classes. In the main
method of the Server class I create a new instance of
ServerConfiguration passing with it the url of the config file. The
problem comes when I want to use this instance of the
ServerConfiguration class in other classes. I don't want to declare
another instance in each class as loading the xml file each time could
be quite resource intensive and i don't really want to have to pass it
as a parameter when instantiating the class as they're will be alot of
classes and I can see that this method could get quite confusing.
Basically what I want to know is if there is a way I can declare the
class once and then use that instance from within the other classes.
Thanks in advance,
James