Choosing how to earn college credit? CLEP vs AP guide
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 3: Class Creation
Start Practice TestPractice Test
About Exam
easy

Default Chaining

Mark
< Prev
Next >

A class utilizes constructor chaining to set a default value when no arguments are provided.

What is printed when the following Java program is compiled and run?

public class QuestionTrace {

    static class Item {

        int code;

        Item() {
            this(100);
        }

        Item(int code) {
            this.code = code;
        }
    }

    public static void main(String[] args) {
        Item i = new Item();
        System.out.print(i.code);
    }
}
A

0

B

100

C

1

D

null

Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Instagram: @_apfive_|Privacy Policy|