- 2
Which package is needed to find the square root . java.lang or java.math
6 Antworten
+ 2
If you are in a hurry – why not google "java square root"?
Anyways, this seems to work:
Math.sqrt(x)
(x is double)
+ 1
Test or interview?
+ 1
Firoz Khan
Java.long is default package , no need to import.
You can use directly sort() method as it is static method in Math class like Math.sqrt(Number); it returns squire root of Number. No need to import any package explicitly....
0
One could do a quick test on sololearn playground and see that
java.lang.Math.sqrt() and Math.sqrt() works and that java math.sqrt() throws an error.
Without knowing much Java I would infer that Math.sqrt() is built-in part of java.lang so we usually don't need to write this part explicitly
- 2
Please give me answer quickly
- 2
I want to know java.lang or java.math