011-002-009
Calling Constructors
Easy
Problem Description
Calling Constructors
In this problem, you will create a program that defines a constructor with arguments in the Person class, initializes fields upon object creation, and displays a self-introduction to standard output.
Learning Objective: Understand how to define and call constructors
Overview
Define a constructor that takes arguments and initialize during object creation.
Specifications
- Define constructor Person(String name, int age) in Person class
- Initialize fields and output self-introduction with introduce() method
- Create instance with new Person("Sato", 30)
Output Format
I am Sato, 30 years old.
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