方法的参数值
参数的值是多少,即 private static boolean Ask(int i){int te = 8 + i;}
因为我注意到该方法中使用了“i”。我只是想知道那个“i”的价值是什么和/或它有什么用处?
What will be the value of the parameter i.e. private static boolean ask(int i){int te = 8 + i;}
Coz i notice the 'i' was use in the method. I just wonder what will be the value of that 'i' and/or what's the use of it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
i
的值将是方法调用者传递到方法调用中的值。因此,如果有人调用
,则该特定调用中的
i
将是5
。参数值特定于方法的特定调用,每次都必须提供,并且每次都会重新评估。即使多个线程同时调用该方法,每个线程都会看到它们传入的i
值。The value of
i
will be whatever the caller of the method passed into the method call.So if someone called
then
i
will be5
within that specific invocation. Parameter values are specific to the particular invocation of the method, must be supplied each time and will be evaluated anew each time. Even if multiple threads are calling the method simultaneously, each will see the value ofi
that they passed in.te 的值将是 8 + i 的值
但它不会编译,因为缺少 return 语句并且该方法说返回了一个布尔值
value of te will be 8 + value of i
but it will not compile since there is a missing return statement and the method says a boolean is returned