R

Ravi Shankar • 4.19K Points
Extraordinary

Q. What will be the output of the following Java program?
class output
{
public static void main(String args[])
{
String a = "hello i love java";
System.out.println(a.indexOf('e')+" "+a.indexOf('a')+" "+a.lastIndexOf('l')+" "+a.lastIndexOf('v'));
}
}

  • (A) 6 4 6 9
  • (B) 5 4 5 9
  • (C) 7 8 8 9
  • (D) 1 14 8 15
  • Correct Answer - Option(D)
  • Views: 31
  • Filed under category JAVA

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics