• 面试题


    package testt;

    public abstract class test2 {
        public static void fun(StringBuffer sb1,StringBuffer sb2) {
            sb1.append(sb2);
            sb2=sb1;
        }
        public static void main(String[] args) {
            StringBuffer a1 = new StringBuffer("we");
            StringBuffer a2 = new StringBuffer("bush");    
            fun(a1,a2);
            System.out.println("a1"+"="+a1+" "+"a2"+"="+a2);
        }
    }
    输出结果:a1=webush a2=bush


    package testt;

    public class test1 {
        static class Person{
            static{
                System.out.println("person init");
            }
        }
        public static void main(String[] args) {
            System.out.println(Person.class.equals(Person.class.getName()));
            System.out.println("===========");
            Person p1 = new Person();
            Person p2 = new Person();
            System.out.println(p1.getClass() == p2.getClass());
        }
        
        
    }
    输出结果:false
    ===========
    person init
    true

    package testt;

    public class test3 {
        static{
            a=3;
        }
        static int a = 5;
        public static void main(String[] args) {
            System.out.println(a);
        }
    }
    输出结果:5

      基本类型       默认值    
    byte 0
    short 0
    int 0
    long 0L
    float 0.0f
    double 0.0d
    char 'u0000'(null)
    boolean false
  • 相关阅读:
    从远程仓库更新本地仓库
    git添加所有新文件
    删除远程仓库文件夹
    更新被驳回
    git安装和第一次提交过程
    JSONobject按照put顺序存储和读取
    Map 转 json格式 保留null值的解决办法
    Java对象转换Json的细节处理
    如何解析json格式的字符串
    json 拼装空list、object
  • 原文地址:https://www.cnblogs.com/hello-liyb/p/7800838.html
Copyright © 2020-2023  润新知