|
@@ -0,0 +1,59 @@
|
|
|
+package com.sf.day05_3;
|
|
|
+
|
|
|
+public class Test {
|
|
|
+
|
|
|
+ static int number = 100;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * 静态方法 : 必须调用静态变量
|
|
|
+ * 实例方法:可以调用静态变量和实例变量
|
|
|
+ */
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ int num = 101;
|
|
|
+ System.out.println(number);
|
|
|
+ System.out.println(num);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @org.junit.Test
|
|
|
+ public void t1(){
|
|
|
+
|
|
|
+ int a = 0;
|
|
|
+ int b = 1;
|
|
|
+ System.out.println(b);
|
|
|
+
|
|
|
+ boolean flag = true;
|
|
|
+ boolean flag2 = false;
|
|
|
+
|
|
|
+
|
|
|
+ System.out.println(number);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @org.junit.Test
|
|
|
+ public void t2(){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ char a = 'a';
|
|
|
+ int b = a+1;
|
|
|
+ System.out.println(a);
|
|
|
+ System.out.println((char) b);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @org.junit.Test
|
|
|
+ public void t4(){
|
|
|
+
|
|
|
+
|
|
|
+ int a = 4;
|
|
|
+ int b = 5;
|
|
|
+ int max = (a>b)?a:b;
|
|
|
+ System.out.println(max);
|
|
|
+ }
|
|
|
+}
|