Limited access

Upgrade to access all content for this subject

Consider the following method.

public static void preAndPost(int x)
{
    if (x < 3)
        System.out.print(x);
    else
        System.out.print(++x);
    if (x < 2)
        System.out.print(x);
    else
        System.out.print(x++);
    if (x < 1)
        System.out.print(x);
    else
        System.out.print(++x);
    if (x < 0)
        System.out.print(x);
    else
        System.out.print(x++);
    System.out.print(x);
}

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

A

22445

B

23455

C

23345

D

23445

E

34566

Select an assignment template