‹ Back to the paper
In the given code snippet, which feature of object-oriented programming concept is being exhibited…
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
AIIt 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.
From ISC Computer Science - Competency Focused Practice Questions (CISCE, August 2024), question 31.