Limited access

Upgrade to access all content for this subject

Consider the following methods.

public static void method1()
{
    method2();
    System.out.println("cat");
}

public static void method2()
{
    method3();
    System.out.println("dog");
}

public static void method3()
{
    method4();
    System.out.println("bird");
}

public static void method4()
{
    System.out.println("fish");
}

Which of the following is printed as a result of the call method2()?

A

cat
dog
bird
fish

B

dog
bird
fish

C

fish
dog
bird

D

fish
bird
dog

E

nothing will print because of an overflow error

Select an assignment template