new and a matching constructor call.class Student { String name; Student() { name = "New Student"; } }, calling new Student() runs Student() and assigns New Student to name.Student() { }.Student(int id, String name) { ... }.★ Must-know
📌 A constructor's name must be identical to its class name, and a constructor has no return type.
Further detail
staticfinalabstractsynchronized1. When does a constructor prepare an object by initializing fields or performing setup?
2. Given `class Student { String name; Student() { name = "New Student"; } }`, what is the result of evaluating `new Student()`?
3. Which description identifies a no-argument constructor?
What does a constructor do when preparing a new object?
It initializes fields or performs setup.
When does a constructor run during object creation?
When the program creates an object with `new` and a matching constructor call.
What must a constructor’s name match?
Its class name.
What return type does a constructor have?
None.
What defines a no-argument constructor?
It has no parameters.
What does a parameterized constructor accept?
Input values.
It covers the core concepts of Java Constructors and Object Lifetime, organized by topic with the key definitions, explanations and takeaways, so it's easier to learn and remember.
Read the full study guide →The practice quiz has 12 multiple-choice questions, each with an explanation. Use it to check what you know and find your gaps.
Take the quiz (12 questions) →There are 30 flashcards on Java Constructors and Object Lifetime, with a question on the front and the answer on the back. Try to recall each answer before you flip, and let spaced repetition bring back the ones you miss.
See all 30 flashcards →Upload a PDF or paste your notes. Revizly writes a study guide, a practice quiz and flashcards in about a minute.