I have an interface with 2 methods say method1 and method2. I want to restrict the implementation of only method1 in class1 and method2 in class2 as shown below. Is it possible?
interface Interface1{
method1();
method2();
}
class Class1 implements Interface1{
method1() {
//method1 implementation
}
//method2 access is restricted
}
class Class2 implements Interface1{
method2() {
//method2 implementation
}
//method1 access is restricted
}