1.请实现两个整数变量的交换
int a = 1;
int b = 2;
//经过交换之后,这里需要大家实现交换的代码
System.out.println(a);//2
System.out.println(b);//1
2.求长方形的周长 和 面积 长为1.5 宽为 4
3.一辆汽车 以40km/h的速度行驶,行驶了45678.9km,求所用的时间
4.定义字符变量赋值为 'A' -->输出 'a'
5.键盘录入两个整数 求 两个整数的 乘积
import java.util.Scanner;
public class work_1{
public static void main (String[] args){
//第一题
int a = 1;
int b = 2;
a=a^b;
b=a^b;
a=a^b;
System.out.println("work_1:");
System.out.println(a);
System.out.println(b);
//第二题
float x = 1.5F;
int y = 4;
System.out.println("work_2:");
System.out.println(2*(x+y));
//第三题
int v = 40;
float h = 45678.9F;
double t = h / v;
System.out.println("work_3:");
System.out.println(t+"h");
//第四题
int aCode = 'A'-('A'-'a');
char aChar = (char)aCode;
System.out.println("work_4:");
System.out.println(aChar);
//第五题
Scanner scan = new Scanner(System.in);
System.out.println("work_5:");
int c = scan.nextInt();
int d = scan.nextInt();
int e = c*d;
System.out.println(e);
scan.close();
}
}