2017-08-22 21:23:37、
writer:pprp
package test; public class helloWorld { int maxn = 123; //常量,需要定义一个对象调用 final int MAX = 20; //类常量,不需要再定义一个对象来调用 static final int MIN = -100; public static void main(String[] args) { // TODO Auto-generated method stub helloWorld p = new helloWorld(); int maxm = 123; char a = '好'; char b = '不'; char c = '好'; int a1 = 0, a2 = -1000, a3 = 2; System.out.println("helloWorld"); System.out.println("haobuhaoma~:"+a+b+c); System.out.println("maxm:" + maxm); System.out.println("maxn:" + p.maxn); System.out.println(p.MAX); System.out.println(MIN); System.out.println(!(a1 > a2)); System.out.println(a3 << 3); //无符号右移 System.out.println(a2 >>> 3); System.out.println(a2 >> 3); String s[] = {"zhangsan","wangwu","lisi"}; int []nums = {0,1,2,3,4,5,6,7,8,9}; int [] arr = {1,2,3,4,5}; //增强版for循环 for(int mm : arr) { System.out.println(mm); } for(int i = 0 ; i < s.length ; i++) System.out.println(s[i]); for(int i : nums) System.out.println(i); //一维数组的使用 int [] ans = {3,2,4,3,22,34}; for(int i = 0 ; i < ans.length; i++) System.out.println(ans[i]); //二维数组的使用 int binary_arr[][] = new int[4][4]; for(int i = 0 ; i < 4 ; i++) { binary_arr[i] = new int[4]; } System.out.println("------"); for(int i = 0 ; i < 4 ; i++) for(int j = 0; j < 4 ; j++) { binary_arr[i][j] = i * j; } for(int j = 0 ; j < 4 ; j++) for(int i = 0 ; i < 4; i++) { System.out.println(binary_arr[i][j]); } } void printnumber() { int c = 20; short y; int z; long k; char d; } }