author | Jaroslav Tulach <jtulach@netbeans.org> |
Sat, 14 Jun 2008 09:50:57 +0200 | |
changeset 12 | 711145230748 |
child 277 | 34370a93db6b |
permissions | -rw-r--r-- |
jtulach@12 | 1 |
|
jtulach@12 | 2 |
package impl; |
jtulach@12 | 3 |
|
jtulach@12 | 4 |
import api.HelloClass; |
jtulach@12 | 5 |
import api.HelloInterface; |
jtulach@12 | 6 |
|
jtulach@12 | 7 |
/** |
jtulach@12 | 8 |
* |
jtulach@12 | 9 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
jtulach@12 | 10 |
*/ |
jtulach@12 | 11 |
public class Main { |
jtulach@12 | 12 |
public static void main(String[] args) throws Exception { |
jtulach@12 | 13 |
HelloClass clazz = new ImplClass(); |
jtulach@12 | 14 |
assert "Hello Unknown!".equals(clazz.sayHello()); |
jtulach@12 | 15 |
assert "Hello Jaroslav!".equals(clazz.sayHelloTo("Jaroslav")); |
jtulach@12 | 16 |
|
jtulach@12 | 17 |
HelloInterface iface = new ImplInterface(); |
jtulach@12 | 18 |
assert "Hello Unknown!".equals(iface.sayHello()); |
jtulach@12 | 19 |
assert "Hello Jaroslav!".equals(iface.sayHelloTo("Jaroslav")); |
jtulach@12 | 20 |
|
jtulach@12 | 21 |
System.err.println("Who defines sayHello(): " + clazz.getClass().getSuperclass().getMethod("sayHello")); |
jtulach@12 | 22 |
System.err.println("Who defines sayHello(): " + iface.getClass().getInterfaces()[0].getMethod("sayHello")); |
jtulach@12 | 23 |
} |
jtulach@12 | 24 |
} |