Advertisements
Advertisements
प्रश्न
Given that:
String sb = "Satyendra Nath Bose";
String nb = ""+sb.charAt(0)+ sb.charAt(sb.indexOf(' ')+1) + sb.charAt(sb.lastIndexOf(' ')+1);
What will be the value of nb?
विकल्प
SNB
snb
ahe
Sat
MCQ
Advertisements
उत्तर
SNB
Explanation:
The code extracts the first letter of each word to form initials. It grabs the first letter of the string ('S'), the letter immediately following the first blank space ('N'), and the letter immediately following the last blank space ('B'). Joining them together results in the text SNB.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
