MCQs > IT & Programming > Java > Output of the given code? public class Test15 { public static void main(String[] args) { VO a = new VO(2); VO b = new VO(3); swapONE(a, b); print(a, b); swapTWO(a, b); print(a, b); } private static void print(VO a, VO b) { System.out.print(a.toString() + b.toString()); } public static void swapONE(VO a, VO b) { VO tmp = a; a = b; b = tmp; } public static void swapTWO(VO a, VO b) { int tmp = a.x; a.x = b.x; b.x = tmp; } } class VO { public int x; public VO(int x) { this.x = x; } public String toString() { return String.valueOf(x); } }

Java MCQs

What is the output of the given code? public class Test15 { public static void main(String[] args) { VO a = new VO(2); VO b = new VO(3); swapONE(a, b); print(a, b); swapTWO(a, b); print(a, b); } private static void print(VO a, VO b) { System.out.print(a.toString() + b.toString()); } public static void swapONE(VO a, VO b) { VO tmp = a; a = b; b = tmp; } public static void swapTWO(VO a, VO b) { int tmp = a.x; a.x = b.x; b.x = tmp; } } class VO { public int x; public VO(int x) { this.x = x; } public String toString() { return String.valueOf(x); } }

Answer

Correct Answer:

2332

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

More Java MCQ Questions

search

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it