Name | Width in Bits | Range |
double | 64 | 1 .7e–308 to 1.7e+308 |
float | 32 | 3 .4e–038 to 3.4e+038 |
package primitiveData;
public class PrimitiveDataTest {
public static void main(String[] args) {
float f = 1.23456789012345678901234567890f; //end with "f" to indicate this is a float type, otherwise, it is a double type by default
double d = 1.23456789012345678901234567890;
System.out.println(f);
System.out.println(d);
}
}
OutPut:
1.2345679
1.2345678901234567
No comments:
Post a Comment