011-002-005

Constructor Invocation: Object Initialization

Easy

Problem Description

constructor Invocation: Object Initialization

In this problem, you will create a program that initializes a Person object using a constructor and displays its name and age to standard output.

Learning Objective: Understand how to invoke a constructor to initialize an object

Overview

Create a Person class with a constructor that receives name and age, initializing the object at creation time.

Specifications

Input

Name and age are provided

Output Format

Name: Taro
Age: 25

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