zoukankan      html  css  js  c++  java
  • Java小代码

    1.

    public class test1 {public static void main(String[] args) {

    Person P = new Person("gdsgds");
    System.out.println(P.name);//输出为null
    }
    }
    class Person{
    String
    name;
    int age;
    public Person(){

    }
    public Person(String name){

    }
    }

    2.class SDText{

      static SDText sd =new SDText();            加载静态区   第一句    第二句    第三句

      static int x=3;          sd         null          0x001    0x001       0x001

      static int y;            x            0    1     3    3

      public SDText(){         y            0    1    1    1

        x++;

        y++;

    }

    }//输出x=3  y=1

    3.

    class SDText{

      SDText sd =new SDText();    

      int x=3;       

      int y;         

      public SDText(){      

        x++;

        y++;

    }//StackOverflowError

  • 相关阅读:
    类数组对象与arguments
    bind的模拟实现
    new的模拟实现
    call和apply的模拟实现
    参数按值传递
    闭包
    执行上下文
    ECMAScript规范解读this
    缓存使用-8、redis的缓存穿透和缓存雪崩
    缓存使用-7、Redis 为什么是单线程的
  • 原文地址:https://www.cnblogs.com/akic/p/10673457.html
Copyright © 2011-2022 走看看