please help me
Army
plz don't spam❌❌
Answers
Answer:
Example 1
Let's see a simple example to display float type variable.
public class FloatExample1 {
public static void main(String[] args) {
float num1=5.5f;
float num2=5f;
System.out.println("num1: "+num1);
System.out.println("num2: "+num2);
}
}
Example 2
In this example, we provide integer value to float variable. Here, compiler implicitly typecast integer to float and display the corresponding value in fractional form.
public class FloatExample2 {
public static void main(String[] args) {
float num1=5;
float num2=10;
System.out.println("num1: "+num1);
System.out.println("num2: "+num2);
}
}
Example 3
In this example, we provide bigger decimal value.
public class FloatExample3 {
public static void main(String[] args) {
float num1=581216732.323433f;
float num2=7.83684987683688f;
System.out.println("num1: "+num1);
System.out.println("num2: "+num2);
}
}
Output:
num1: 5.812167E8 num2: 7.8368497