What is the output of this program?
class output
{
public static void main(String args[])
{ String a = "hello i love java"; System.out.println(a.indexOf('i')+" "+a.indexOf('o')+" "+a.lastIndexOf('i')+" "+a.lastIndexOf('o'));
}

Respuesta :

Answer:

6 +4 + 6 +4

Explanation:

It will start from index 0 and wherever you find the character inside the indexOf methods then you will note it down.