Challenge: Create a Book Class
Aufgabe
Swipe to start coding
Practice creating a class with both a default and a parameterized constructor. Your goal is to implement a Book class that can be initialized with or without specifying the title and author.
- The class must have two public string fields:
TitleandAuthor. - The default constructor must set both
TitleandAuthorfields to"Unknown". - The parameterized constructor must accept two string parameters and assign them to the
TitleandAuthorfields, respectively. - Creating a
Bookwithout parameters must initialize it with"Unknown"values. - Creating a
Bookwith parameters must initialize it with the provided values.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 2
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Suggested prompts:
Can you explain this in simpler terms?
What are some examples related to this topic?
Where can I learn more about this?
Großartig!
Completion Rate verbessert auf 4.17
Challenge: Create a Book Class
Swipe um das Menü anzuzeigen
Aufgabe
Swipe to start coding
Practice creating a class with both a default and a parameterized constructor. Your goal is to implement a Book class that can be initialized with or without specifying the title and author.
- The class must have two public string fields:
TitleandAuthor. - The default constructor must set both
TitleandAuthorfields to"Unknown". - The parameterized constructor must accept two string parameters and assign them to the
TitleandAuthorfields, respectively. - Creating a
Bookwithout parameters must initialize it with"Unknown"values. - Creating a
Bookwith parameters must initialize it with the provided values.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 2
single