+ 3
Whats wrong here
class Math{ public static void main (String []args) { double x = Math.random(); System.out.println(x); } }
3 ответов
+ 5
i'm assuming that it's the fact you named your class math and didn't define a random() method within it
+ 2
Because your class name is Math, the compiler will seek random in your class first.To make it right by a easy way, I think you should rename your class.
0
The Math class is a predefined class in Java. You are creating another Math class without the random method and calling it instead of calling the other Math class