1.
package chapter2; public class set { public static void main(String[] args) { int c; int a = 1; int b = 2; c = a; a = b; b = c; System.out.println("a=" + a + " b=" + b); } }
2.
package chapter2; public class set { public static void main(String[] args) { int a = 345, sum; int b, c, d, e; b = a / 1000; c = a/ 100 % 10; d = a % 100 / 10; e = a % 10; sum = b + c+ d + e; System.out.println( "输出的值为" +sum); } }
3.
package chapter2; public class set { public static void main(String[] args) { // TODO Auto-generated method stub float huashi = 666, sheshi; sheshi = ((huashi - 32) * 5) / 9; huashi = ((sheshi * 9) / 5) + 32; System.out.println("摄氏度:" + sheshi); System.out.println("华氏度:" + huashi); } }
4.
package chapter2; public class set { public static void main(String[] args) { // TODO Auto-generated method stub char f = 'A'+32; System.out.println("小写为"+f); } }