Computer Science, asked by abcd65807, 8 months ago

What will be the output of below statements? String s = "Java String Quiz"; System.out.println(s.charAt(s.toUpperCase().length()));​

Answers

Answered by sanjiththesupernigha
1

Answer:

Runtime error

Explanation:

It will throw the runtime exception.Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 16 It’s because the index value starts from 0.

Answered by qwvilla
1

In the given program segment

String s = "Java String Quiz"; System.out.println(s.charAt(s.toUpperCase().length()));

It will throw the runtime exception.

There will be Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 16

This is because the index value starts from 0.

#SPJ3

Similar questions