
Java
"this" refers to the object instance on which the method was called. For example, in the line of code:
int len = "abcde".length();
Even though String.length() takes no arguments, a reference to a String instance containing "abcde" is passed to length() through the keyWord "this." A possible implementation of String.length() could then be:
public int length() {
return this.chars.length;
}
However, in most cases, it is not necessary to explicitly use "this."
The "super" keyWord points to the same object as "this" but is instead used to call a member of the object's superclass rather than of the object's concrete class.
Copyright © 2026 eLLeNow.com All Rights Reserved.