Java question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Java question

Can i do this in java? double pi = Math.PI();

17th Apr 2021, 4:29 PM
Eric
3 Answers
+ 8
Eric No you can do Math.PI not Math.PI() PI is not a method it's a value. In Math class it is declared as public static final double PI = 3.14159...;
17th Apr 2021, 4:37 PM
A͢J
A͢J - avatar
+ 3
Maybe it would be like this: https://code.sololearn.com/cA0A0a7A04A1
17th Apr 2021, 4:36 PM
The future is now thanks to science
The future is now thanks to science - avatar
0
PI is a variable, not a method.
21st Aug 2021, 4:06 AM
Evseev Anton
Evseev Anton - avatar