Re: Trying to create a working internal confirm JOptionPane
phillip.s.powell@gmail.com wrote:
Not sure why you feel that is the means of my confusion, but
nonetheless, though I have no choice but to blindly follow it, I don't
personally like the fact that I can have:
if (SimpleBrowser.isValidURL("http://www.sun.com")) {
SimpleBrowser.this.setURL(new URL("http://www.sun.com"));
}
because the visual syntax is confusing into thinking this.setURL() is
a static reference of SimpleBrowser when it's not. That was my point.
It is only confusing because you have not learned to recognize the difference
between when "this" is to the right of the dot vs. when a variable or method
name is to the right of the dot.
Once you get used to it, and get over liking or disliking it, you will see how
it makes sense.
Try this thought experiment - from an inner class, what syntax would you
invent to refer to the outer object's "this" if you were designing Java?
Then accept what Sun did.
Lew said:
- as the first line of a constructor, the invocation of another constructor in
the class, as in
public Foo()
{
this( DEFAULT );
}
phillip.s.powell@gmail.com wrote:
That one lost me completely, sorry.
Study the syntax and effect of the constructor calls "this(...)" and
"super(...)", which must appear as the first line of a constructor if they are
used.
When something like an explanation of constructor call "this()" "loses" you,
how about you Google for it, or study the Sun tutorials, or the Java Language
Specification?
- Lew