Computer Applications

Write Java statements for the following:

(a) To assign the cube root of -343 to a variable with the appropriate datatype.
(b) To assign the position of the last occurrence of @ in the String s with the appropriate datatype.

Java Math Lib Methods

5 Likes

Answer

(a) double cubeRoot = Math.cbrt(-343);

(b) int pos = s.lastIndexOf('@');

Answered By

3 Likes


Related Questions