✏️ Explanatory Question

What will the following code output:

String s = "malayalam";
System.out.println(s.indexOf('m'));
System.out.println(s.lastIndexOf('m'));

👁 69 Views
📘 Detailed Answer
🟢 Easy
💡

Answer with Explanation

Output


0
8

Explanation



The first m appears at index 0 and the last m appears at index 8.