public class Main {
public static interface Hello {
public void hello();
}
public static class HelloWorld implements Hello{
public void hello() {
}
public void goodbye() {
System.
out.
println("Good bye!!!"); }
}
public static void main
(String[] args
) { HelloWorld hw = new HelloWorld();
hw.hello();
hw.goodbye();
example(hw);
Hello h = new HelloWorld();
h.hello();
// h.goodbye(); エラー。呼び出せない
// example(h); エラー。呼び出せない
}
public static void example(HelloWorld hw){
hw.goodbye();
}
}
cHVibGljIGNsYXNzIE1haW4gewoJcHVibGljIHN0YXRpYyBpbnRlcmZhY2UgSGVsbG8gewoJCXB1YmxpYyB2b2lkIGhlbGxvKCk7Cgl9CgkKCXB1YmxpYyBzdGF0aWMgY2xhc3MgSGVsbG9Xb3JsZCBpbXBsZW1lbnRzIEhlbGxvewoJCXB1YmxpYyB2b2lkIGhlbGxvKCkgewoJCQlTeXN0ZW0ub3V0LnByaW50bG4oIkhpISEhIik7CgkJfQoJCQoJCXB1YmxpYyB2b2lkIGdvb2RieWUoKSB7CgkJCVN5c3RlbS5vdXQucHJpbnRsbigiR29vZCBieWUhISEiKTsKCQl9Cgl9CgoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewoJCUhlbGxvV29ybGQgaHcgPSBuZXcgSGVsbG9Xb3JsZCgpOwoJCWh3LmhlbGxvKCk7CgkJaHcuZ29vZGJ5ZSgpOwoJCWV4YW1wbGUoaHcpOwoJCQoJCUhlbGxvIGggPSBuZXcgSGVsbG9Xb3JsZCgpOwoJCWguaGVsbG8oKTsKCQkvLyBoLmdvb2RieWUoKTsgICAg44Ko44Op44O844CC5ZG844Gz5Ye644Gb44Gq44GECgkJLy8gZXhhbXBsZShoKTsgICAg44Ko44Op44O844CC5ZG844Gz5Ye644Gb44Gq44GECgl9CgkKCXB1YmxpYyBzdGF0aWMgdm9pZCBleGFtcGxlKEhlbGxvV29ybGQgaHcpewoJCWh3Lmdvb2RieWUoKTsKCX0KfQ==