1(viii)
What will be the output of the following statement?
String s = "JavaProgramming"; System.out.println(s.substring(4, 11).toUpperCase());
- (a)Programm
- (b)PROGRAMM
- (c)PROGRAM
- (d)program
Show SolutionHide Solution↓
PROGRAM
Reason — In the string "JavaProgramming", indexing starts at 0. substring(4, 11) extracts characters from index 4 to 10, which is "Program". Calling .toUpperCase() converts it to "PROGRAM".