Home > Back-end >  The small white consult parameter assignment problem
The small white consult parameter assignment problem

Time:09-25


The static void the get (int data) {
Data=https://bbs.csdn.net/topics/100;
}

Public static void main (String [] args) {
Int temp=3;
Get (temp);

System. The out. Println (temp);
}

This way, why not 100 the temp, assign the void functions?


CodePudding user response:

The get method is static not return a value, and then you give the get method is assignment of the temp value, so that the output of course is the temp value: 3

CodePudding user response:

Value transfer is passed, it is not itself the
 
Static int the get (int data) {
Data=https://bbs.csdn.net/topics/100;
return data;
}

Public static void main (String [] args) {
Int temp=3;
Temp=get (temp);

System. The out. Println (temp);
}

CodePudding user response:

Java is value
  • Related