
Hi,
What is the correct method to define float variables in Java?
float f = 3.0f;
double d = 3.0d;
Thanks


public class JavaFloatExample {
/* Learn How to define and use float variable in Java */
public static void main(String[] args) {
// Defining float variable
float fMoney = 124567.25f;
System.out.println("Money Value is: " + fMoney);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.