What is the output of the following JAVA program? class

Duration: 5 min

Q4752

PYQ UGC NET 2018

What is the output of the following JAVA program?

class simple
{
    public static void main(String[] args)
    {
        simple obj = new simple();
        obj.start();
    }
    void start()
    {
        long[] P = {3, 4, 5};
        long[] Q = method(P);
        System.out.print(P[0] + P[1] + P[2] + ":");
        System.out.print(Q[0] + Q[1] + Q[2]);
    }
    long[] method(long[] R)
    {
        R[1] = 7;
        return R;
    }
} // end of class
  1. A.

    12:15

  2. B.

    15:12

  3. C.

    12:12

  4. D.

    15:15

Attempted by 74 students.

Sign up free to check your answer

Sign up free

Explore the full course: Mppsc Assistant Professor Computer Science Paper 2

Loading lesson…