static method should be accessed in a static way

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oll3i
    Contributor
    • Mar 2007
    • 679

    #1

    static method should be accessed in a static way

    Config cfg=null;
    cfg=Config.getI nstance();
    eclipse highlights Config.getInsta nce(); saying the staic method getInstance() from the type Config should be accessed in a static way ?

    Thank YOU
  • BigDaddyLH
    Recognized Expert Top Contributor
    • Dec 2007
    • 1216

    #2
    Originally posted by oll3i
    Config cfg=null;
    cfg=Config.getI nstance();
    eclipse highlights Config.getInsta nce(); saying the staic method getInstance() from the type Config should be accessed in a static way ?

    Thank YOU
    [CODE=Java]Config cfg=Config.getI nstance();[/CODE]

    looks like it is accessing it the static way. That warning is usually generated when you invoke a static method using an object, for example:

    [CODE=Java]String s = ...
    String t = s.valueOf(17);[/CODE]

    Comment

    • oll3i
      Contributor
      • Mar 2007
      • 679

      #3
      thank you very very much it worked :)

      Comment

      Working...