?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Easy

Increment vs Decrement as Parameters to Print Statement

APCSA-EVU6KW

Consider the following method.

public static void incrementDecrement(int x)
{
    System.out.print(++x);
    System.out.print(x++);
    System.out.print(--x);
    if (x++ == 5)
        return;
    System.out.print(x--);
    System.out.print(x);
}

What is printed as a result of the method call incrementDecrement(4)?

A

454

B

555

C

55555

D

55565

E

An error occurs because void methods cannot return a value