NET as there is in the method of judging a user is not, in the words returned his phone number
I can define methods
boolean GetUserPhone (string username, out string phone);
Call
string phone;
boolean has = GetUserPhone ("Jerry", out phone);
Console.Write ("the existence =" + has.ToString ());
Console.Write ("phone number =" + phone);
-------------------------------------------------- -
But I found the time to write Java code Java No out this function
That should be how to achieve my Java right above request?
Thank you<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Package a class, the need to return the contents into them.
If
public class PhoneInfo {
Boolean isExists;
String Phone;
}
PhoneInfo GetUserPhone (string username) {
...
}
Reply:
This is too much trouble, right?
When I only want to return, there are two return values have a class package
Reply:
It can only use one floor of the method, java on virtue, original design parameters considered pass-by-reference increases the complexity of the language, did not design this feature
No comments:
Post a Comment