Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

11. Using the code on te llwing page, race the progrom when the main method is e

ID: 3748758 • Letter: 1

Question

11. Using the code on te llwing page, race the progrom when the main method is executed. Output Before changing the volues 1 12 After changing the values: 1 12 Affer calling changeVoluer Sets up three variables jone primfive and two otyects) ko Modfies lhe pararmeters prring their values before and eir vakaes beloee and afer caling e method public void changeValuesint 11, Num 12,Num 13 publc static vold main (3tring ang System out printnBefore changing the values System out prvo, ntr. Parameter Tesher toster new Parametor Testeri Num a2 new Num (222: Num a3 m new Num (333); System.out printin Befee calling changevales System.out printinCafta2la3: System.out.printin (al T-a2.T-a3 Sester changeValues (af, a2, a3 -999 2 setValue (88 0 a new Num 777 System.out prier changing the values System.out.printinCatda2das pubic class Num private int value publc void setvaue int update) public Num int update) value update: value n updale public String toString 0 publkc int getalue o roturn value: return value

Explanation / Answer

before calling changeValues

a1 a2 a3

111 222 333

before changing the values

f1 f2 f3

111 222 333

after changing the values

f1 f2 f3

999 888 777

after calling changeValues

a1 a2 a3

111 888 777

here a1 is primitive and a2 and a3 are the reference variables so the values

whatever we change changeValues function will effect to a2 and a3 not for a1

Dr Jack
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote