package tydu;
class father{
public void baba(){
System.out.println("hahah");
go(4);
}
public void go(int x) {
int z=x+1;
System.out.println(z);
}
}
public class jiekou {
public static void main(String[] args) {
// TODO Auto-generated method stub
father f=new father();
f.baba();
}
}
结果是:
hahah
5
第一个方法在执行过程中调用第二个方法。
当你调用一个方法时,该方法会放在调用栈的栈顶。