How to Explicitly implement 2 interface method that having same signature in java? -
this question has answer here:
i have 2 interface this:
interface ia{ void show(); } interface ib{ void show(); }
now want implement both interface method explicitly class.
in c# can using "explicit interface implementation method" this:
interface ia { void show(); } interface ib { void show(); } class derived : ia, ib { void ia.show() { console.writeline("hello c#!"); } void ib.show() { console.writeline("hello world !"); } }
is there way or keyword java solve problem?
as long both methods have same return type, can implemented single method within class.
otherwise, cannot implemented , compile error viewed.
there no way in java explicitly implement each method per interface.
Comments
Post a Comment