首页 > 代码库 > 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 内存分析
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。