1、控制台输入密码

        Console console = System.console();//eclipse中为null
        String username = null;
        username = console.readLine("username:");
        char[] pass = console.readPassword("password:");

2、java不允许同名变量,即便作用域不同

3、大数:

        BigInteger bint = BigInteger.valueOf(10000000);
        // 不能超过int或long的范围
        BigInteger bint2 = new BigInteger("100000000000000");
        System.out.println(bint.multiply(bint2));

4、数组复习:

初始化:

        int[] a = {1,2,3};
        int[] b = new int[10];
        int[] c = new int[]{3,4,5};

简单方式打印数组:

System.out.println(Arrays.toString(a));

深度复制:

int[] a_copy = Arrays.copyOf(a, a.length*2);//多余的为0

results matching ""

    No results matching ""