Challenge: Overloaded Movie Class
Task
Swipe to start coding
Create a Movie class that supports multiple ways to initialize its fields using overloaded constructors.
- The class must have a default constructor that sets the
Titleto"Unknown"andReleaseYearto0. - The class must have a constructor that takes a
titleparameter and setsTitleto the given value andReleaseYearto0. - The class must have a constructor that takes both a
titleand areleaseYear, and sets the fields accordingly.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 4
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Can you explain this in simpler terms?
What are the main takeaways from this?
Can you give me an example?
Awesome!
Completion rate improved to 4.17
Challenge: Overloaded Movie Class
Swipe to show menu
Task
Swipe to start coding
Create a Movie class that supports multiple ways to initialize its fields using overloaded constructors.
- The class must have a default constructor that sets the
Titleto"Unknown"andReleaseYearto0. - The class must have a constructor that takes a
titleparameter and setsTitleto the given value andReleaseYearto0. - The class must have a constructor that takes both a
titleand areleaseYear, and sets the fields accordingly.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 4
single