新建类Example01,分别定义两个字节型变量b1、b2; 两个整型变量a1、a2;一个长整型变量1;一个单精度浮点型f; 一个双精度浮点型d;两个字符型变量ch1、ch2;一个布尔型变量flag,并在控制台实现以下打印效果: b1=100,b2=18 a1=12,a2=340000 l=239 f=1.34 d=3.14 ch1=x,ch2=好 flag=true
时间: 2023-03-19 15:21:03 浏览: 105
class Example01 {
public static void main(String[] args) {
byte b1 = 100;
byte b2 = 18;
int a1 = 12;
int a2 = 340000;
long l = 239;
float f = 1.34f;
double d = 3.14;
char ch1 = 'x';
char ch2 = '好';
boolean flag = true;
System.out.println("b1=" + b1 + "," + "b2=" + b2);
System.out.println("a1=" + a1 + "," + "a2=" + a2);
System.out.println("l=" + l);
System.out.println("f=" + f);
System.out.println("d=" + d);
System.out.println("ch1=" + ch1 + "," + "ch2=" + ch2);
System.out.println("flag=" + flag);
}
}
阅读全文