Class passparam4 ...{
Int obj_param;
Public static void main (string [] ARGs )...{
Int Param;
Param = 50;
Changeparam (PARAM); // call 1: transfer of the basic variable type (master the relationship between stack memory and heap memory)
System. Out. println (PARAM );
/***//*******************************/
Passparam4 paramobj = new passparam4 ();
Paramobj. obj_param = 50;
Changeparam (paramobj. obj_param); // call 2: transfer of the basic variable type (two basic variables are actually operated)
System. Out. println (paramobj. obj_param );
Paramobj. obj_param = 50;
Changeparam1 (paramobj); // call 3: object transfer (the actual operation is the same object)
System. Out. println (paramobj. obj_param );
Paramobj. obj_param = 50;
Changeparam2 (paramobj); // call 4: object transfer (actually one object is passed, and change is another object)
System. Out. println (paramobj. obj_param );
}
Public static void changeparam (int param )...{
Param = 30;
}
Public static void changeparam1 (passparam4 paramobj )...{
Paramobj. obj_param = 30;
}
Public static void changeparam2 (passparam4 paramobj )...{
Paramobj = new passparam4 ();
Paramobj. obj_param = 30;
}
}