Menu
Question Index
...

What will be the output of the following program?

public class MyClass {
    public static void main(String srit[]) {
        myMethod();
    }
    static void myMethod() {
        int x, y;
        x = 5;
        y = 3;
        System.out.print("(" + x + ", " + y + ")");
        points(x, y);
        System.out.print(" (" + x + ", " + y + ")");
    }
    static void points(int x, int y) {
        int xy;
        xy = x;
        x = y;
        y = xy;
        System.out.print(" (" + x + ", " + y + ")");
    }
}


(5, 3) (3, 5) (3, 5)
(5, 3) (5, 3) (5, 3)
(5, 3) (3, 5) (5, 3)
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java Methods - Parameter Passing And Scope

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App