第一次上机作业
1. package chap1; public class Main { public static void main(String[] args) { int a=1; int b=2; int temp = a; a = b; b=temp; System.out.println(a+" "+b); } } 2. package chap1; public class Main { public static void main(String[] args) { int a=12; int x=12%10; int y=12/10; int sum=x+y; System.out.println("sum="+sum); } } package chap1; public class Main { public static void main(String[] args) { int a=0005; int b=0005%10; System.out.println(" "+b); } } 3. package chap1; public class Main { public static void main(String[] args) { int a=50; int b=(a-32)*5/9; System.out.println("华氏度="+b); } } 4. package chap1; public class Main { public static void main(String[] args) { char a='A'; System.out.println((char)(a+32)); } }