java 基础面试代码题目


    public static void main(String[] args) {
        {
            short a = 1;
            int b = 1;
            System.out.println(a == b);
        }
        {
            Integer i = new Integer(100);
            Integer j = new Integer(100);
            System.out.println(i == j);
            //false
        }
        {
            Integer i = new Integer(100);
            int j = 100;
            System.out.println(i == j);
            //true
        }
        {
            Integer i = new Integer(100);
            Integer j = 100;
            System.out.println(i == j);
            //false
        }
        {
            Integer i = 100;
            Integer j = 100;
            System.out.println(i == j);
            //true
        }
        {
            Integer i = 128;
            Integer j = 128;
            System.out.println(i == j);
            //false
            Integer.valueOf(100);
        }
        {
            String s1 = new String("aaa");
            String s2 = new String("aaa");
            System.out.println(s1 == s2);
            // false
        }
        {
            String s5 = "bbb";
            String s6 = "bbb";
            System.out.println(s5 == s6);
            System.out.println("compare: " + s5.compareTo(s6));
            System.out.println("compare: " + s5.equals(s6));
            // true
        }
        List<String> list = new ArrayList<>();
        Collections.sort(list);
        String[] b = {"a", "b"};
        Arrays.sort(b);
    }

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读