Given:
public class Test1 {
static void doubling (Integer ref, int pv) {
ref =20;
pv = 20;
}
public static void main(String[] args) {
Integer iObj = new Integer(10);
int iVar = 10;
doubling(iObj++, iVar++);
System.out.println(iObj+ ", "+iVar);
What is the result?
- 11, 11
- 10, 10
- 21, 11
- 20, 20
- 11, 12
Answer(s): A
Explanation:
The code doubling(iObj++, iVar++); increases both variables from to 10 to 11.
Reveal Solution Next Question