第二次作业
1、已知a,b均是整型变量,写出将a,b两个变量中的值互换的程序。(知识点:变量和运算符综合应用)
package bwk; public class sjlx { public static void main(String[] args) { // TODO Auto-generated method stub int a = 1,b = 10; int temp = a; a = b; b = temp; System.out.println(a+" "+b); } }
1、已知a,b均是整型变量,写出将a,b两个变量中的值互换的程序。(知识点:变量和运算符综合应用)
package bwk; public class sjlx { public static void main(String[] args) { // TODO Auto-generated method stub int a = 1,b = 10; int temp = a; a = b; b = temp; System.out.println(a+" "+b); } }