007-003-011

Class Instantiation

Easy

Problem Description

class Instantiation

In this problem, you will create a program that instantiates a Person class, sets the name field to "Alice" and the age field to 30, and displays the result to standard output.

Learning Objective: Understand how to create objects from classes

Overview

Create an instance of Person class, set field values, and output them.

Specifications

  • Person class has name (String) and age (int) fields
  • Create a Person instance, set name to "Alice" and age to 30
  • Output name and age

Output Format

Name: Alice
Age: 30

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