java - How to cast to run superclass method -
this question has answer here: overriding methods in java , casting object parent class behavior 5 answers is there way use casting m1() method run in i1 class print in i1 class ? don't want run 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(); } no, can't this. part of point of polymorphism able hide implementation detail classes lower down in hierarchy. can invoke superclass method, call inside overridden method. think this. maybe testclass important inside method m1 maintains in...