java float example

float f1 = 5.5f;
float f2 = 5.4f;

how would you initialize a static float without using the wrapper class?

static float f1 = 5.5f

would that be correct?

Recommended Answers

All 2 Replies

Did you try it out?

Yes, it works, but like firstPerson said just try it next time.

You could also use
public static float afp = (float)2.34; //or any decimal value

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.