📄 dosample0.java
字号:
class Integer //定义一个整型类
{
int i; //i定义为整型类的成员变量
}
class sample0
{
int test(Integer a) //参数a是整型类的对象
{
return ++a.i; //++a.i使实例变量i的值加1
}
}
class DoSample0
{
public static void main(String args[])
{
sample0 r=new sample0();
Integer a=new Integer();
a.i=1;
System.out.println(r.test(a)); //r.test(a)将a的地址传送给形参,
//a.i=2
System.out.println(r.test(a)); //再次调用r.test(a),a.i=3
System.out.println("This is the result:");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -