
Concept Notes
🔹 What is a Constructor?
A constructor in Java is a special method that:
- Has the same name as the class.
- Is automatically called when an object is created.
- Does not have a return type (not even void).
- Used to initialize objects.
🔹 Types of Constructors in Java
1️⃣ Default Constructor
- Provided by compiler if no constructor is defined.
- Initializes variables with default values.
class Student {
int id;
String name;
Student() { // Default Constructor
id = 0;
name = "Unknown";
}
}
2️⃣ Parameterized Constructor
- Accepts arguments to initialize objects.
class Student {
int id;
String name;
Student(int i, String n) { // Parameterized Constructor
id = i;
name = n;
}
}
3️⃣ Copy Constructor (not built-in like C++, but can be written manually)
- Creates a new object by copying values from another object.
class Student {
int id;
String name;
Student(Student s) { // Copy Constructor
id = s.id;
name = s.name;
}
}
🔹 Constructor Overloading
- Defining multiple constructors with different parameter lists.
- Java calls the correct one based on arguments.
class Student {
int id;
String name;
Student() { // Default
id = 0;
name = "Unknown";
}
Student(int i) { // One parameter
id = i;
name = "NoName";
}
Student(int i, String n) { // Two parameters
id = i;
name = n;
}
}
Overloading gives flexibility while creating objects.
⚙️ Important Points (Exam View)
- Constructors don’t have a return type.
- this() can be used to call one constructor from another.
- super() calls parent class constructor.
- Constructor Overloading is based on number and type of parameters.
🔟 10 Most Expected MCQs – ECET 2026 [Java – Constructors]
Q1. A constructor in Java:
A) Has the same name as class
B) Has a return type
C) Is inherited
D) Can be abstract
Q2. Which of these is true for constructors?
A) They cannot be overloaded
B) They have the same name as class
C) They can return int
D) They must be static
Q3. Default constructor initializes:
A) Random values
B) Garbage values
C) Default values
D) User-defined values
Q4. Constructor overloading depends on:
A) Method name
B) Return type
C) Number/type of parameters
D) None
Q5. Copy constructor in Java is:
A) Built-in
B) Must be manually defined
C) Not allowed
D) Automatic
Q6. Which keyword is used to call parent class constructor?
A) this
B) super
C) parent
D) extends
Q7. Constructor can be:
A) Overloaded
B) Static
C) Abstract
D) Final only
Q8. When is a constructor called?
A) When object is created
B) When class is loaded
C) When method is called
D) During compilation
Q9. Which of these is invalid for constructors?
A) Having parameters
B) Having same name as class
C) Having a return type
D) Being overloaded
Q10. If no constructor is defined in a class, compiler provides:
A) Copy constructor
B) Parameterized constructor
C) Default constructor
D) None
✅ Answer Key
Q.No | Answer |
---|---|
Q1 | A |
Q2 | B |
Q3 | C |
Q4 | C |
Q5 | B |
Q6 | B |
Q7 | A |
Q8 | A |
Q9 | C |
Q10 | C |
🧠 Explanations
- Q1 → A: Constructors always have the same name as the class.
- Q2 → B: They cannot have return type, only same name as class.
- Q3 → C: Default constructor assigns default values (0, null, false).
- Q4 → C: Overloading depends on number/type of parameters.
- Q5 → B: Java doesn’t provide copy constructor, we must define manually.
- Q6 → B:
super()
calls parent class constructor. - Q7 → A: Constructors can be overloaded but not abstract/static.
- Q8 → A: Called automatically at object creation.
- Q9 → C: Constructors cannot have a return type.
- Q10 → C: Compiler provides default constructor.
🎯 Why This Practice Matters for ECET 2026
- Java constructors are a fixed topic in ECET exams.
- At least 1–2 direct questions come every year.
- Understanding constructor overloading makes OOP concepts strong for interviews too.
📲 CTA (Join Our Prep Community)
👉 Get daily ECET MCQs, solved problems & videos here: @LearnNewThingsHub