007-002-011
Object Creation: Default Values
Easy
Problem Description
Object Creation: Default Values
In this problem, you will create a program that defines an Item class with uninitialized fields, instantiates it, and outputs each field's default value (String defaults to null, int to 0, boolean to false) to standard output.
Learning Objective: Understand that object fields are initialized with default values
Overview
Create a program that checks the default values of fields immediately after object creation.
Specifications
- Create an
Itemclass - Define String
name, intcount, and booleanavailablefields - Create an object and output each field's default value
Output Format
Name: null
Count: 0
Available: false
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up