1(xv)
Which one of the following will be the output of the below statements?
String a[]={"Rohini", "Rajarshi", "Rajeev", "Rehan", "Rebecca"};
System.out.println(a[2].substring(2));- (a)jeev
- (b)Ra
- (c)Raj
- (d)je
Show SolutionHide Solution↓
jeev
Reason — In the array, the element at position 2 is "Rajeev". In Java, string indexing starts from 0, so index 0 = R, index 1 = a, and index 2 = j. Using substring(2) means we take all characters from index 2 to the end, giving "jeev".