✏️ Explanatory Question

What is the value stored in variable res given below:

double res = Math.pow ("345".indexOf('5'), 3);

👁 98 Views
📘 Detailed Answer
🟢 Easy
💡

Answer with Explanation

Value of res is 8.0
Index of '5' in "345" is 2. Math.pow(2, 3) means 23 which is equal to 8