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

In the given code snippet, which feature of object-oriented programming concept is being exhibited…

Computer Science20251 markShort answer
In the given code snippet, which feature of object-oriented programming concept is being exhibited by the substring( ) method?
String s1 = "sandwich"; 
System.out.println(s1.substring(4)); 
System.out.println(s1.substring(1,4));

Answer

Answer

AI
It exhibits method overloading (compile time/static polymorphism): the class String has two versions of substring( ) - substring(int) and substring(int, int) - with the same name but a different number of parameters.
Inheritance, Interfaces and Polymorphism

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