Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2055

Re: Why "Static field should be accessed in a static way" ?

From markspace <-@.>
Newsgroups comp.lang.java.help
Subject Re: Why "Static field should be accessed in a static way" ?
Date 2012-08-22 08:54 -0700
Organization A noiseless patient Spider
Message-ID <k12vba$mlm$1@dont-email.me> (permalink)
References <5034c6c8$0$282$14726298@news.sunsite.dk>

Show all headers | View raw


On 8/22/2012 4:47 AM, Timothy Madden wrote:
> Hello
>
> To my knowledge, using non-static access even for static fields/methods
> is good practice.

No, where the heck did you hear this? Do you have a source you can cite? 
  Seriously, if there's some site spreading misinformation I'd like a 
link to it.

> It allows for later changing the field into and
> instance field..

First, English grammar: look it up.  Second, refactoring is easy.

> It also allows for using that field without knowing
> much wheather it is static or not.

That's the problem: anyone reading your code won't know that it's a 
static member.  Also, learn to spell.

>
> Is there some reason why tools like Eclipse claim the field should be
> accessed in a static way ?

Because it's best practice.


Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why "Static field should be accessed in a static way" ? Timothy Madden <terminatorul@gmail.com> - 2012-08-22 14:47 +0300
  Re: Why "Static field should be accessed in a static way" ? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-22 08:45 -0400
    Re: Why "Static field should be accessed in a static way" ? Lew <noone@lewscanon.com> - 2012-08-22 06:31 -0700
  Re: Why "Static field should be accessed in a static way" ? markspace <-@.> - 2012-08-22 08:54 -0700
    Re: Why "Static field should be accessed in a static way" ? Timothy Madden <terminatorul@gmail.com> - 2012-08-22 21:05 +0300
      Re: Why "Static field should be accessed in a static way" ? Roedy Green <see_website@mindprod.com.invalid> - 2012-08-23 09:44 -0700
  Re: Why "Static field should be accessed in a static way" ? Roedy Green <see_website@mindprod.com.invalid> - 2012-08-23 08:58 -0700

csiph-web