在Java的数字字面量中使用下划线
以下是显示如何在Java中的数字文字中使用下划线的代码-
示例
public class Demo{
public static void main (String[] args) throws java.lang.Exception{
int my_num_1 = 6_78_00_120;
System.out.println("The number is : " + my_num_1);
long my_num_2 = 2_00_11_001;
System.out.println("The number is : " + my_num_2);
float my_num_3 = 4.01_981F;
System.out.println("The number is : " + my_num_3);
double my_num_4 = 12.89_46_061;
System.out.println("The number is : " + my_num_4);
}
}输出结果
The number is : 67800120 The number is : 20011001 The number is : 4.01981 The number is : 12.8946061
名为Demo的类包含main函数,该函数使用各种格式的整数,长整数,浮点值和双精度值在下划线的帮助下显示数据。每个变量都分配给一个变量,该变量打印在控制台上。
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下