English

Write the output of the codes given below. String sa = "Success is a journey"; String sb = "It is not a destination"; int p1 = sa.lastIndexOf('b');

Advertisements
Advertisements

Question

Write the output of the codes given below.

String sa = "Success is a journey"; String sb = "It is not a destination";
int p1 = sa.lastIndexOf('b');    String ta = sa.substring (0, p1);
p1 = ta.lastIndexOf('b');        ta = ta.substring (0, p1);
int p2 = sb.indexOf ('b');     String tb = sb.substring (p2+1);
p2 = tb.indexOf('b');     tb = tb.substring (p2);
ta = ta.concat (tb); System.out.print("Finally we can say :: "+ta);
Very Short Answer
Advertisements

Solution

Finally we can say :: Success is not a destination

shaalaa.com
  Is there an error in this question or solution?
Chapter 10: String Handling - Exercises [Page 247]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 10 String Handling
Exercises | Q 2. (f) | Page 247
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×