Is there a way to use casting so the m1()
method is run in I1
class to print In I1 class
? I don't want it to run the overridden method.
class TestClass extends I1 implements I2{
public void m1() { System.out.println("Hello"); }
public static void main(String[] args){
I1 tc = new TestClass();
tc.m1();
}
}
class I1{
int VALUE = 1;
public void m1(){System.out.println("In I1 class");}
}
interface I2{
int VALUE = 2;
void m1();
}