Ask Question

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'));

}

+4
Answers (1)
  1. 13 July, 07:27
    0
    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What is the output of this program? class output { public static void main (String args[]) { String a = "hello i love java"; System. out. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers