java - What is the difference between String. and String.this. ? -


this question has answer here:

i'll straight point. im still learning bit of syntax , want know difference between code is

code a:

 public class buttonz extends jbutton{          public buttonz(){             settext(new string(string.valueof(i)));         }      } 

please ignore fact i undeclared, not lost.

code b:

public class buttonz extends jbutton{      public buttonz(){         settext(new string(string.this.charat(i)));     }  } 

what don't yet understand difference in typing string.this , string.

i under assumption when use dot operator on class accessing it's static methods(and/or variables if they're not hidden).

i have studied little bit , have concluded when using string. accessing string static methods.. when using string.this. i'm accessing methods class buttonz extending.

is correct?

i apologize if right , wasting time. need sure move on. thank you.

string.this "qualified this" syntax. used refer either this, if current class string (which not in case), or if local or anonymous class (a type of inner class), this of enclosing class named string contains class. have not showed if class inside class; doubt case. if is, enclosing class named string not java.lang.string, must other class named string, since cannot add code existing classes. , then, highly doubt have method named charat() returns can passed new string(). in conclusion, not real code.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -