DESKTOP-QUF3J7K_20200905-柴宁宁

问题:

3 题 :已知 int a= 0x122 则 a / 2 为 145

​ **用0开头表示八进制

​ **用0x或者0X开头表示十六进制

8 题 :代码说明正确的

private static int x = 100;

public static void main(String[] args) {
        Text8 h1 = new Text8();
        h1.x++;                         //101
        Text8 h2 = new Text8();
        h2.x++;                         //102
        h1 = new Text8();
        h1.x++;                         //103
        Text8.x--;                      //102
    
        System.out.println("x=" + x);   //102

    }

​ 被 static 修饰的成员变量是 类变量

​ Text8.x--; 在静态方法中引用静态变量(类变量)

11 题 :程序段正确的是

public static void main(String[] args) {
        
        String s1 = "a" + "b";
        
        String s2 = new String(s1);
        
        if( s1 == s2 ) {
            System.out.println( " == is succeeded ");
        }
        
        if( s1.equals(s2) ) {
            System.out.println( " .equals() is succeeded ");
        }
    }

​ 通过 new() s2 指向堆里值 ab 此时s1 s2 内容是一样的 ,但地址不同

吐槽:

充满了恶意,,不努力,怎么能知道你是学不会的