Re: Static classes



Altman wrote:
> I am making a class called utilities which I plan to have a couple of
> static methods in it. I have declared the class as follows.
> public class Utilities {
> public static Settings userData = new Settings();
> // static methods go here
> }
>
> My question is: do I have to create an instance of the Utilities
> class in order for my userData object to be available?

No.

(But I wouldn't expose a non-final field like that, myself.)

-- chris



.



Relevant Pages

  • Re: Static classes
    ... > static methods in it. ... > public class Utilities { ... > public static Settings userData = new Settings; ...
    (comp.lang.java.programmer)
  • Re: Static classes
    ... static methods in it. ... public static Settings userData = new Settings; ...
    (comp.lang.java.programmer)
  • Static classes
    ... I am making a class called utilities which I plan to have a couple of ... static methods in it. ... public static Settings userData = new Settings; ...
    (comp.lang.java.programmer)
  • Re: global functions?
    ... refer to the physical location such as another DLL or the app_code folder. ... just make another class and create static methods. ...
    (microsoft.public.dotnet.framework.aspnet)