• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes

Problem :

I am facing the below error in my program saying:

Lyrics.java:11: error: cannot find symbol

symbol: method Cube(int)

location: class Lyrics

Lyrics.java:15: error: incompatible types: possible lossy conversion from double to int

 return Math.pow (b, 3);
2 errors

I did research on my issue and it turns out that other people also had the same issue but none of them have solution on it. And also I am unable to understand the above error saying cannot find symbol. Please help me I am really been stuck on this error for a while.

by (2.5k points)  

1 Answer

0 votes

Solution :

The very first problem I can see is the simple typo. Java is case sensitive language, so “cube” and “Cube” mean completely different things. Solution: 1) Please be consistent, and 2) Please use names starting with the lowercase letters for method names as per your Java style guides.

The second problem is due to your method signature for a Math.pow; please see the javadoc. It seems it returns the result as the double. You then try to return the double as the int, and that is a incorrect conversion.

So the solutions is as below:

return b * b * b;   // i.e. please don't use `pow`.


return (int) Math.pow(b, 3);


Hope this solution solves your problem.

by (33.3k points)