So I want to print out the math functions, "PI" and "E."
Here is how I'm trying to do it:
System.out.println(Math.PI);
System.out.println(Math.E);
I think I have to import the math library.
E and PI are not functions, they're static fields (data members). That code will output their values correctly. You don't have to import anything, the Math class is in the java.lang package, which is imported by default. (It's the only package imported by default, I believe.)
You don't have to import anything here. The java.lang.Math class should already be available as java.lang package is imported by default
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With