'why cant we access the method2-interface [duplicate]
Why cant we access the method2? I mean d is instance of A or am i wrong?
public class MainPage {
public static void main(String[] args) {
interfaceExample d=new A();
d.method1();
//d.method2(); this is not accessible why?
}
}
interface interfaceExample{
void method1();
}
class A implements interfaceExample{
@Override
public void method1() {
// TODO Auto-generated method stub
}
public void method2() {
// TODO Auto-generated method stub
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
