Skip to main content

Unit 3 · Class Creation

Return Values

Return Values MCQ Practice

Question 1 of 15

Answered 0 of 15

Choose one answer.

What is printed by the following code segment?

public class ReturnValuesContext
{
    public static int pick(int n)
    {
        if (n > 0)
        {
            return 1;
        }
        return -1;
    }

    public static void main(
        String[] args)
    {
        System.out.print(pick(0));
    }
}
Choose one answer.