Nigel Wade wrote:
It's best not to use tabs in code [that's posted to Usenet].
Not all news readers handle them in the sameway.
Tabbed code can sometimes be very hard to decipher.
As can top-posting.
Several people have pointed out that the way to refer to a static variable is
by the syntax
Classname.staticVariable
Chris Dollin also pointed out:
Rename the variables to something sensible and the problem evaporates.
This is a very important principle. This answer is not a dodge or hack to
avoid having to say "RangeClass.i". Rather, it's a signpost to good, solid,
maintainable, professional code. Variable names, especially for class and
instance variables, should be self-descriptive. "i" is far too terse for a
good variable name. What is "i"? A range limit? A unique id? A counter?
Something else entirely?
Another dodge for setters is always to name the method argument "value".
public void setLimit( int value )
{
limit = value;
}
Works great for static or instance methods.
Check out these resources for new Java developers:
<http://java.sun.com/docs/books/tutorial/index.html>
<http://www.mindprod.com/jgloss/gettingstarted.html>
In general, <http://www.mindprod.com/> has a ton of great education in it.
--
Lew
member, you would be better off.
//etc... so forth
objects, then look into the singleton pattern. Although, I personally