014-003-006
Constructor Call with super()
Easy
Problem Description
constructor Call with super()
In this problem, you will create a program that explicitly calls the parent class (Person) constructor from the child class (Student) constructor using super(), reads a name from standard input, and displays it to standard output.
Learning Objective: Understand how to explicitly call parent class constructor using super()
Overview
Create a program that calls the parent class constructor from the child class constructor using super().
Specifications
- Define a constructor in Person class that takes String name
- Student class extends Person and defines a constructor that passes name to parent
- In Main class, use Scanner to read one line of input, create a Student, and output the name
Input Format
name (one line)
Output Format
Name: name
Input/Output Example
Input: Taro
Output: Name: Taro
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