什么时候调用User.toString()
?
private JSONObject convert(String stringRepresentation) { --> A
// Some code here.
// This is when we actually do something with "stringRepresentation":
someMethod(stringRepresentation); --> B
}
用法:
JSONConverter.convert(User.toString());
User.toString()
方法是在调用 convert(String stringRepresentation)
后立即调用的吗 (A),然后它的值会被记住并在需要时正确使用或者是在实际使用 stringRepresentation
的方法的代码中调用 User.toString()
(B)?
最佳答案
作为 convert
的实际参数,它在调用 convert
之前被调用(一次)。
关于java - 将方法的结果作为参数传递给函数时,何时调用该方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33214445/