1 public class test1{ 2 public static void main(String[] args){ 3 int num = 10; 4 System.out.println(num); 5 System.out.println(Integer.MAX_VALUE); 6 System.out.println(Integer.MIN_VALUE); 7 8 9 } 10 }
打印int型的长度(4个字节)
定义局部变量时必须初始化
1 public class test1{ 2 public static void main(String[] args){ 3 int a = 10; 4 int b = 20; 5 int c = a; 6 a = b; 7 b = c; 8 9 System.out.println(a); 10 System.out.println(b); 11 } 12 }
交换两个数的值
原文:https://www.cnblogs.com/Leafbud/p/12721567.html