English

State the output of the following program segment: String str1 = "great"; String str2 = "minds"; System.out.println(str1.substring(0,2).concat(str2.substring(1))); Systern.out.println(("WH" + - Computer Applications

Advertisements
Advertisements

Question

State the output of the following program segment:

String str1 = "great"; String str2 = "minds"; 
System.out.println(str1.substring(0,2).concat(str2.substring(1))); 
Systern.out.println(("WH" + (str1.substring(2).toUpperCase()))); 
Short Answer

Solution

The output of the program segment is as follows:

grinds
WHEAT

shaalaa.com
  Is there an error in this question or solution?
Chapter 4: String Handling - Review Insight [Page 284]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 4 String Handling
Review Insight | Q 7. | Page 284
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×