Create a free account on Computer Sir Ki Class and unlock access to valuable learning resources.
Exam Paper Downloads: After registering and logging in, you can download exam question papers in PDF format to practice and prepare for your exams.
Student Support: Get assistance with your doubts, queries, and questions related to your studies. Our support is here to help you understand topics and resolve your learning difficulties.
Register today and make your exam preparation easier and more effective!
State the output of the following Β program segment is executed :
String a = "Smartphone", b = "Graphic Art";
String h = a.substring(2, 5);
String k = b.substring(8).toUpperCase();
System.out.println(h);
System.out.println(k.equalsIgnoreCase(h));
Answer:
String a = “Smartphone”, b = “Graphic Art”;
String h = a.substring(2, 5);
h would be “art” as character index 2 would be a and index 5 would be t
String k = b.substring(8).toUpperCase();
k would be “ART” as from index 8 till end would be “Art” and its upper case would be returned.
System.out.println(h);
This will print art
System.out.println(k.equalsIgnoreCase(h));
This will print true as after ignoring case both art and ART would be same.
C. Sir| Created: 22-Mar-2018 | Updated: 16-Apr-2019|ICSE2015