how can we use math .pi without using impot java.lang.Math*;

PROGRAMING LANG:- JAVA

Recommended Answers

All 3 Replies

You can...
import static java.lang.Math.PI; and refer to it as PI
or
don't use an import and refer to it as java.lang.Math.PI in your code.

Why???

example of how to use Math.PI:
/
System.out.println(5
Math.PI);
*/

you don't even need to import the java.lang.Math.* thing.

yes correct

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.