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?
views:
39answers:
2
+3
A:
The value of i
will be whatever the caller of the method passed into the method call.
So if someone called
ask(5);
then i
will be 5
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 of i
that they passed in.
Andrzej Doyle
2010-06-29 10:42:38
+1
A:
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
Redlab
2010-06-29 10:43:45