PRASHNIKAप्रश्निका
‹ Back to the paper

interface A { final static int x = 5; abstract void abc( ); } interface B { final static int y = 5…

Computer Science20251 markMCQ
interface A 
{ 
    final static int x = 5; 
    abstract void abc( ); 
} 

interface B 
{ 
    final static int y = 5; 
    abstract void abc( ); 
}
Assume that class Check implements interfaces A and B, how many times the method abc( ) will be defined in class Check ?
  • aTwice
  • bOnce
  • cCompile time error
  • dRuntime error

Answer

Answer

AI

Correct option: b

Answer: (b) Once. Both interfaces A and B declare the same abstract method signature abc( ). When class Check implements both, providing one concrete definition of abc( ) satisfies the abstract method requirement of both interfaces, so it is defined only once.
Inheritance, Interfaces and Polymorphism

From ISC Computer Science - Competency Focused Practice Questions (CISCE, August 2024), question 17.