πŸ“Š JAVA
Q. Given the following piece of code:
class Person{
public int number;
}
public class Test{
public void doIt(int i , Person p){
i = 5;
p.number = 8;
}
public static void main(String args[]){
int x = 0;
Person p = new Person();
new Test().doIt(x, p);
System.out.println(x + " " + p.number);
}
}

What is the result?
  • (A) 0 8
  • (B) 5 0
  • (C) 0 0
  • (D) 5 8
πŸ’¬ Discuss
βœ… Correct Answer: (A) 0 8

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
87
Total Visits
πŸ“½οΈ
12 mo ago
Published
πŸŽ–οΈ
Admin
Publisher
πŸ“ˆ
95%
Success Rate