Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

What does the following code output to the screen?

What does the following code output to the screen?

class Foo

{

    public static void main(String[] args)

    {

             int num1 = 10;

             int numArray[] = {100,200,300,400,500};

             Helper h = new Helper();

       h.value = 50;

             MyMethod(num1);

             System.out.println(num1);

             MyMethod(h);

             System.out.println(h.value);

             MyMethod(numArray[2]);

             System.out.println(numArray[2]);

             MyMethod(numArray);

             System.out.println(numArray[1]);

  }

  public static void MyMethod(int i)

  {

             i += 5;

  }

public static void MyMethod(Helper h)

{

             h.value += 5;

}

public static void MyMethod(int i[])

{

             for (int j = 0; j < i.length; j++)

             {

                            i[j] += 5;

             }

  }

}

class Helper

{

    public int value;

}

HTML Editor

Keyboard Shortcuts

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question