|
Last change
on this file since 1394 was 2, checked in by bird, 23 years ago |
|
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
|
File size:
603 bytes
|
| Line | |
|---|
| 1 | import java.util.*;
|
|---|
| 2 |
|
|---|
| 3 | public class MethodFailure4 {
|
|---|
| 4 |
|
|---|
| 5 | public static String call(A obj) {
|
|---|
| 6 | return "A";
|
|---|
| 7 | }
|
|---|
| 8 | public static String call(I obj) {
|
|---|
| 9 | return "I";
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | interface I {}
|
|---|
| 13 | static class A {}
|
|---|
| 14 | static class B extends A implements I {}
|
|---|
| 15 | static class C extends B {}
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 | public static A getA() {
|
|---|
| 19 | return new A();
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | public static B getB() {
|
|---|
| 23 | return new B();
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | public static C getC() {
|
|---|
| 27 | return new C();
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | public static I getI() {
|
|---|
| 31 | return new C();
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | // this method invocation is ambiguous
|
|---|
| 35 |
|
|---|
| 36 | public static void main(String[] argv) {
|
|---|
| 37 | call( getC() );
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.