Course Content
Java Extended
Java Extended
Challenge: Team Constructor
Task
Swipe to show code editor
Here is a class called Team
written for you. Your task is to write a constructor that takes all 4 parameters and initializes all 4 fields. Please do not modify the Main
class and its methods.
- Write a constructor with 4 parameters:
name
,sport
,yearFounded
, andcity
. - Initialize the
name
field with the value of thename
parameter. - Initialize the
sport
field with the value of thesport
parameter. - Initialize the
yearFounded
field with the value of theyearFounded
parameter. - Initialize the
city
field with the value of thecity
parameter.
Solution
solution
Switch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?
Thanks for your feedback!
Section 4. Chapter 7
Challenge: Team Constructor
Task
Swipe to show code editor
Here is a class called Team
written for you. Your task is to write a constructor that takes all 4 parameters and initializes all 4 fields. Please do not modify the Main
class and its methods.
- Write a constructor with 4 parameters:
name
,sport
,yearFounded
, andcity
. - Initialize the
name
field with the value of thename
parameter. - Initialize the
sport
field with the value of thesport
parameter. - Initialize the
yearFounded
field with the value of theyearFounded
parameter. - Initialize the
city
field with the value of thecity
parameter.
Solution
solution
Switch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?
Thanks for your feedback!
Section 4. Chapter 7
Switch to desktop for real-world practiceContinue from where you are using one of the options below