Prashnikaप्रश्निका
Code
About
‹ Back to the paper

Question 17

1 mark

Computer ScienceISC Computer Science - Competency Focused Practice Questions (CISCE, August 2024)MCQInheritance, Interfaces and Polymorphism

Choose the correct option.

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

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 ?
  • (a)Twice
  • (b)Once
  • (c)Compile time error
  • (d)Runtime error

Answer

Answer

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.