zoukankan      html  css  js  c++  java
  • java 内存分析之堆栈空间

    package Demo;
    
    public class Demo {
        public static void main(String[] args) {
            Demo demo = new Demo();  
            int date = 9;
            BirthDate d1 = new BirthDate(7, 7, 1970);
            BirthDate d2 = new BirthDate(5, 8, 2000);
            demo.change1(date);
            demo.change2(d1);
            demo.change3(d2);
    
        }
        public void change1(int i) {
            i = 1234;
        }
        public void change2(BirthDate b) {
            b = new BirthDate(22, 2, 2004);
        }
        public void change3(BirthDate b) {
            b.setDay(22);
        }
    }
    测试类
    package Demo;
    
    public class BirthDate {
        private int day;
        private int month;
        private int year;
        
        public BirthDate(int d, int m, int y) {
            day = d;
            month = m;
            year = y;
        }
        public void Display() {
            System.out.println(day+"-"+month+"-"+year );
        }
        public int getDay() {
            return day;
        }
    
        public void setDay(int day) {
            this.day = day;
        }
    
        public int getMonth() {
            return month;
        }
    
        public void setMonth(int month) {
            this.month = month;
        }
    
        public int getYear() {
            return year;
        }
    
        public void setYear(int year) {
            this.year = year;
        }
        
    }
    java bean

    内存分析图:

  • 相关阅读:
    修改MySQL表varchar字段的小实验
    MySQL5.6同步指定数据库
    Redis安装
    MongoDB安装
    RMAN备份注意事项
    Oracle Data Guard Protection Modes
    Linux Shell 文本处理工具
    ORACLE 收缩表空间的数据文件
    crfclust.bdb导致磁盘满
    undo管理
  • 原文地址:https://www.cnblogs.com/Mike_Chang/p/6947227.html
Copyright © 2011-2022 走看看