What will be the output of the following Java program?class output {public static void main(String args[]){ String s = "Hello World"; int i = s.indexOf('o'); int j = s.lastIndexOf('l'); System.out.print(i + " " + j); } }

🎲 Try a Random Question  |  Total Questions in Quiz: 56  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
Java Basics Practice Test: String Handling — practice the complete quiz, review flashcards, or try a random question.

Java Quiz on the character extraction, string handling functions like stringbuffer class and methods, stringjoiner class and other string comparison functions. Java strings are immutable objects, which means that once a string object is created, its value cannot be changed. This means that any methods that appear to modify a string object actually create a new string object with the modified value. This can be confusing at first, but it is an important concept to understand. There are many methods available for manipulating strings in Java. Some of the most common methods... Show more

What will be the output of the following Java program?<br>class output <br>{<br>public static void main(String args[])<br>{ String s = "Hello World";<br> int i = s.indexOf('o');<br> int j = s.lastIndexOf('l');<br> System.out.print(i + " " + j);<br> <br>}<br> }