extend abstract class & implement interface, different return type methods

abstractclass X

{

publicabstract String method();

}

interface Y

{

publicvoid method();

}

class Zextends Ximplements Y

{

// Compiler error, If I don't implement both methods

// If I implement only one method, compiler error is thrown for not

// implementing another method

// If I implement both the methods,duplicate method error is thrown by

//compiler

}

The same problem can occur if both methods throw different checked exceptions,or if access modifiers are different..etc

I'm preparing for SCJP, So just had this weired thought. Please let me know

if there is a way to solve this.

[1364 byte] By [John_noblea] at [2007-11-27 4:25:32]
# 1
Nothing you can do about it except for changing the design.Kaj
kajbja at 2007-7-12 9:33:43 > top of Java-index,Java Essentials,Java Programming...
# 2
hmm..sounds obvious..Thanks
John_noblea at 2007-7-12 9:33:43 > top of Java-index,Java Essentials,Java Programming...