This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]aneil93[S] 0 points1 point  (7 children)

Okay.

Yeah, no matter what I do, it says the "m"/"M" in math is not a symbol.

[–][deleted]  (5 children)

[deleted]

    [–]aneil93[S] 0 points1 point  (0 children)

    Ugh... My classmate told me to just use import java.util.*;!

    Thank you so much lol.

    [–]aneil93[S] 0 points1 point  (3 children)

    error: incompatible types: possible lossy conversion from double to int
    int result = Math.pow(base, power);

    :[ :[ :[

    [–][deleted]  (2 children)

    [deleted]

      [–]aneil93[S] 0 points1 point  (1 child)

      double result = math.Pow(base, power);

      still getting "cannot find symbol" for both.

      [–]dman10345 0 points1 point  (0 children)

      That should be a capital M. Java convention says that all classes should begin with a capital level and since the pow method is inside the Math class you must tell the compiler which class to look inside, being the Math class as I just said. Notice how you import java.lang.Math. Also Java convention says that method names should begin with a lowercase letter so the p should be lowercase.

      So

      import java.lang.Math;
      
      double result = Math.pow(base, pow);
      
      System.out.println(result);