I keep getting CircleInformation.java:13: error: cannot find symbol float circumference = 2 (PI radiusF)

Recommended Answers

That's not enough code. As in what is PI and what is radiusF.

Jump to Post

All 4 Replies

That's not enough code. As in what is PI and what is radiusF.

radiusF has to be a variable fro this program, but PI is probably the obvious constant from the java.util.Math class. You can only make an unqualified reference to it like that if you have imported it at the beginning of the source file.

commented: how do i make radiusf a variable? its suppose to be radius but the f is because its has to be a float +0

I have everything defined already
double PI = 3.14159;
float radius = 3.85f;
float circumference = 2 PI radiusf;

commented: radius and radiusf. Think this over. +15

Maybe this is where you are misunderstanding something... (?)
When you define a float constant you need an f, eg 123f, 3.14159fetc so the compiler knows you want a float and not a double.
But when you use a float variable you never add an f to its name - declaring it as float was enough for the compiler to know what to do.
float x = 123f; System.out.println(x); NOT System.out.println(xf);

Be a part of the DaniWeb community

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