Multiple choice technology programming languages

What will happen when you attempt to compile and run the following code? class MyParent { int x, y; MyParent(int x, int y) { this.x = x; this.y = y; } public int addMe(int x, int y) { return this.x + x + y + this.y; } public int addMe(MyParent myPar) { return addMe(myPar.x, myPar.y); } } class MyChild extends MyParent { int z; MyChild (int x, int y, int z) { super(x,y); this.z = z; } public int addMe(int x, int y, int z) { return this.x + x + this.y + y + this.z + z; } public int addMe(MyChild myChi) { return addMe(myChi.x, myChi.y, myChi.z); } public int addMe(int x, int y) { return this.x + x + this.y + y; } } public class MySomeOne { public static void main(String args[]) { MyChild myChi = new MyChild(10, 20, 30); MyParent myPar = new MyParent(10, 20); int x = myChi.addMe(10, 20, 30); int y = myChi.addMe(myChi); int z = myPar.addMe(myPar); System.out.println(x + y + z); } }

  1. 300

  2. 240

  3. 120

  4. Compilation error

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The code compiles and runs successfully. myChi.addMe(10, 20, 30) returns 10 + 10 + 20 + 20 + 30 + 30 = 120. myChi.addMe(myChi) calls addMe(10, 20, 30) on itself, returning 120. myPar.addMe(myPar) returns 10 + 10 + 20 + 20 = 60. The sum is 120 + 120 + 60 = 300.