内存执行流程
日期: 2020-11-05 分类: 跨站数据 387次阅读
一、内存区域划分是什么?
所谓的内存区域划分有 1.栈 2,堆
3. 方法区
二、试例程序
1.代码
代码如下(示例):
package cn.yunhe.four;
public class liftCycle {
private String breakfast;
String lunch;
String dinner;
public void setName(String newbreakfast) {
breakfast = newbreakfast;
}
public String getName() {
return breakfast;
}
public void foodName() {
System.out.println("今天早餐是"+getName()+
"午餐是"+lunch+"晚餐是"+dinner);
}
}
package cn.yunhe.four;
public class qi {
public static void main(String[] args) {
// TODO Auto-generated method stub
liftCycle liftcycle = new liftCycle();
liftcycle.dinner = "盖浇饭";
liftcycle.lunch = "烩面";
liftcycle.setName("包子");
liftcycle.foodName();
}
}
除特别声明,本站所有文章均为原创,如需转载请以超级链接形式注明出处:SmartCat's Blog
标签:java
上一篇: 构造器与set,get方法初始化
精华推荐