LearnFrenzy
Sign in Take a free test

Classes and Objects · Classes and Objects MCQ · Question 7

Field values of a new object Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 7 Back to Exercise

A class has fields int age; String name; boolean active;. What are they right after new (no constructor code)?

  • A Random values
  • B 0, null, false Correct
  • C 0, "", false
  • D Compile error
Correct Answer: Option B

Fields always get default values.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links