EXPRESSIONS
Method Invocation Expressions
15.11
in class
S
, even if that field is hidden by a declaration of a field named
name
 in
class
C
.
The use of
super
 is demonstrated by the following example:
interface I { int x = 0; }
class T1 implements I { int x = 1; }
class T2 extends T1 { int x = 2; }
class T3 extends T2 {
int x = 3;
void test() {
System.out.println("x=\t\t"+x);
System.out.println("super.x=\t\t"+super.x);
System.out.println("((T2)this).x=\t"+((T2)this).x);
System.out.println("((T1)this).x=\t"+((T1)this).x);
System.out.println("((I)this).x=\t"+((I)this).x);
}
}
class Test {
public static void main(String[] args) {
new T3().test();
}
}
which produces the output:
x=
3
super.x=
2
((T2)this).x=
2
((T1)this).x=
1
((I)this).x=
0
Within class
T3
, the expression
super.x
 is treated exactly as if it were:
((T2)this).x
15.11   Method Invocation Expressions
A method invocation expression is used to invoke a class or instance method.
MethodInvocation:
MethodName
 (
ArgumentList
opt
 )
Primary
 .
Identifier
 (
ArgumentList
opt
 )
super .
Identifier
 (
ArgumentList
opt
 )
The definition of
ArgumentList
 from  15.8 is repeated here for convenience:
ArgumentList:
Expression
ArgumentList
 ,
Expression
323






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved