Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What is a constructor?
Think about how an object gets its initial state.
What does a default constructor do?
Focus on the word 'default'.
What is a constructor in Java?
It's essential for object initialization.
Are constructors allowed to have a return type?
Remember the definition of constructors.
Create a class Book with two constructors: one default and one that takes parameters for title and author.
Think about what values you'd want as defaults.
Demonstrate constructor overloading by implementing a basic Shape class that can accept different parameters for defining shapes (like circles and squares).
Consider how different shapes require different values.
5 more questions in this section. Enroll free to practise them all.
Enroll free