What is the value stored in variable p given below:
double p = Math.pow ("1234", indexOf('4"), 3);
Answers
Answered by
7
Explaination:-
- The above shows the string "1234" above which the index of each characters are given.
- Remember: Index starts with 0.
- indexOf() returns the index of character given in the parameter.
- Here the string is "1234" of whose index of 4 we have to find.
- Refer to the first point which shows index of each character . As we can see, index of "4" is 3
Now,
Math.pow(3,3)
>>9.0
- Because Math.pow() returns number raised to power other number in double data type.
Correct Answer:-
- 9.0
Answered by
0
doublep=Math.pow("1234".indexOf("4"),3);
>>Math.pow(3,3)
>>9.0
Similar questions