★★★★★
"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."
Ria Mukherjee
Parent
ICSE Class 10 · Computer Applications (Java) · Constructors 2027
Constructors ICSE Class 10 questions come in three shapes: a one-line definition, a difference between a constructor and a method, and a Section B class whose first instruction is "a default constructor to initialise the data members". This page answers all three. It gives the definitions the way an examiner wants them, a comparison table, two complete class-design programs with sample runs from Java 21, the traps that turn up as output questions, and a set of Section A questions with answers. Our live mini batch writes these classes against the clock every fortnight.
Live online · definitions in one line · two class-design programs, run · constructor traps · first class free
Start here
The ICSE Java course is where these classes are written each fortnight. ISC Computer Science picks up constructors at once and builds on them, and the data structures course shows why every node and list in real code starts life in a constructor.

The batch / ICSE CA
Class 9 and 10 Computer Applications in a mini batch, where every Section B class opens with a constructor that is marked line by line.
Open the course →
Next step / ISC
For students going on to ISC, where every class question starts with a parameterized constructor and objects are passed between methods.
Open the course →
Beyond the syllabus / DSA
For the student who wants to see constructors build linked lists, stacks and trees one object at a time.
Open the course →Ans. The short version
Constructors ICSE Class 10 questions test four things. A constructor is a member method with the same name as its class and no return type, not even void, that runs automatically when an object is created with new, to give the data members their starting values. A default constructor takes no parameters; a parameterized constructor takes values; overloading means several constructors that differ in their parameter lists. And a constructor differs from a method in name, return type and how it is called. Modern Age Coders teaches the chapter live in a Tuesday and Wednesday mini batch in India, or one to one at the family's time.
Q1. What is a constructor in Java, in the words ICSE expects?
A constructor is a member method with the same name as the class and no return type, which is called automatically when an object is created and is used to initialise the object's data members. Each term below is worth one mark when written this cleanly.
| Term | One-sentence definition | Smallest example |
|---|---|---|
| Constructor | A member method with the same name as its class and no return type, invoked automatically by new to initialise a new object. | Pen() { ink = 100; } |
| Default constructor | A constructor with no parameters, which gives every data member a fixed starting value. | Pen() { colour = "blue"; ink = 100; } |
| Parameterized constructor | A constructor that receives values as parameters and copies them into the data members of the new object. | Pen(String c, int i) { colour = c; ink = i; } |
| Compiler-supplied constructor | If a class defines no constructor at all, Java adds an empty no-argument one, which leaves members at their default values (0, 0.0, false, null). | new Box() works with no constructor written |
| Constructor overloading | Defining more than one constructor in the same class, each with a different number, type or order of parameters. | TimeSpan(), TimeSpan(int), TimeSpan(int, int) |
The this keyword | A reference to the current object, used inside a constructor when a parameter has the same name as a data member. | this.x = x; |
void. Add one and it stops being a constructor.new creates the object; you never call it with a dot.public so objects can be created from outside the class.Constructors only make sense once a class is seen as a template for objects, which is the chapter before this one: class as the basis of all computation.
Q2. How is a constructor different from a method?
A constructor has the class's name and no return type and runs by itself when an object is made; a method has any name, must declare a return type and runs only when it is called. A four-mark difference question wants at least four rows of this table, each written as a pair.
| Point | Constructor | Method |
|---|---|---|
| Name | Same as the class | Any valid identifier |
| Return type | None, not even void | Must have one, void or a data type |
| How it runs | Automatically, when new creates an object | Only when called, as ob.show() |
| How many times per object | Once, at creation | As many times as it is called |
| Purpose | To initialise the data members | To carry out a task on the data |
| If none is written | Java supplies an empty no-argument one | Nothing is supplied |
| Point | Default (no-argument) | Parameterized |
|---|---|---|
| Parameters | None | One or more |
| Starting values | The same for every object | Different for each object, sent in by the caller |
| Object creation | new Pen() | new Pen("black", 40) |
| Supplied by Java? | Yes, if no constructor is written | Never; you must write it |
class Fan {
int speed;
Fan(int s) { // constructor
speed = s;
}
int Fan(int s) { // a method that happens to share the name
return s * 2;
}
public static void main(String[] args) {
Fan f = new Fan(3);
System.out.println(f.speed + " " + f.Fan(3));
}
}
// Output: 3 6
Java allows a method with the class's name. The int in front is what makes the second one a method, so it runs only when called with a dot.
class Demo {
void Demo() {
System.out.println("method, not constructor");
}
}
// in main:
Demo d = new Demo();
System.out.println("object made");
d.Demo();
// Output
object made
method, not constructor
new Demo() prints nothing, because the only constructor is the empty one Java supplied. The message appears only when the method is called.
Overloading methods follows the same rule as overloading constructors, and the methods chapter has its own programs on user-defined methods and function overloading. More two-column answers of this kind are on ICSE Computer Applications difference between questions.
Q3. How is a constructor used in a Section B class?
Most Section B class-design questions list the data members, then ask for a constructor, then input, calculation and display methods, then a main that creates an object and calls them. Below are two original questions in that shape, each with a variable description table and a sample run copied from Java 21.
Question 1. Define a class ExamResult with data members name (String), eng, maths and comp (int), avg (double) and grade (char). Write a default constructor to initialise the data members, void accept() to read the name and three marks, void compute() to find the average and the grade (90 and above A, 75 to below 90 B, 60 to below 75 C, 40 to below 60 D, below 40 E) and void display() to print the name, the average to two decimal places and the grade. Write main to create an object and call the methods.
import java.util.Scanner;
class ExamResult {
String name; // student's name
int eng, maths, comp; // marks in three subjects
double avg; // average of the three
char grade; // grade worked out from avg
ExamResult() { // default constructor
name = "";
eng = 0;
maths = 0;
comp = 0;
avg = 0.0;
grade = ' ';
}
void accept() {
Scanner sc = new Scanner(System.in);
System.out.print("Enter name: ");
name = sc.nextLine();
System.out.print("Enter marks in English, Maths and Computer: ");
eng = sc.nextInt();
maths = sc.nextInt();
comp = sc.nextInt();
}
void compute() {
avg = (eng + maths + comp) / 3.0;
if (avg >= 90)
grade = 'A';
else if (avg >= 75)
grade = 'B';
else if (avg >= 60)
grade = 'C';
else if (avg >= 40)
grade = 'D';
else
grade = 'E';
}
void display() {
System.out.println("Name: " + name);
System.out.println("Average: " + Math.round(avg * 100) / 100.0);
System.out.println("Grade: " + grade);
}
public static void main(String args[]) {
ExamResult ob = new ExamResult();
ob.accept();
ob.compute();
ob.display();
}
}
Dividing by 3.0, not 3, keeps the fraction. Math.round(avg * 100) / 100.0 is the syllabus-safe way to keep two decimal places.
| Variable | Type | Purpose |
|---|---|---|
| name | String | student's name |
| eng, maths, comp | int | marks in the three subjects |
| avg | double | average of the three marks |
| grade | char | grade decided from avg |
| sc | Scanner | reads input from the keyboard |
| ob | ExamResult | the object created in main |
Enter name: Ishaan Rao Enter marks in English, Maths and Computer: 88 79 95 Name: Ishaan Rao Average: 87.33 Grade: B
262 / 3.0 is 87.333..., rounded to 87.33. Test the lowest slab too: 35, 41 and 38 give an average of 38.0 and grade E.
Question 2. Define a class TimeSpan with data members hours and minutes (int). Overload the constructor: TimeSpan() sets both to 0; TimeSpan(int total) converts a number of minutes into hours and minutes; TimeSpan(int h, int m) stores hours and minutes, carrying any extra minutes into hours. Write int toMinutes() and void display(). In main, read the values with Scanner, create one object with each constructor, display all three and print the difference between the second and third in minutes.
import java.util.Scanner;
class TimeSpan {
int hours; // whole hours
int minutes; // minutes left over, 0 to 59
TimeSpan() { // default constructor
hours = 0;
minutes = 0;
}
TimeSpan(int total) { // from a number of minutes
hours = total / 60;
minutes = total % 60;
}
TimeSpan(int h, int m) { // from hours and minutes
hours = h + m / 60;
minutes = m % 60;
}
int toMinutes() {
return hours * 60 + minutes;
}
void display() {
System.out.println(hours + " h " + minutes + " min");
}
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a time in minutes: ");
int t = sc.nextInt();
System.out.print("Enter hours and minutes: ");
int h = sc.nextInt();
int m = sc.nextInt();
TimeSpan a = new TimeSpan();
TimeSpan b = new TimeSpan(t);
TimeSpan c = new TimeSpan(h, m);
a.display();
b.display();
c.display();
System.out.println("Difference = "
+ Math.abs(b.toMinutes() - c.toMinutes()) + " min");
}
}
Java picks the constructor by the number of arguments: none, one or two. The integer division and remainder by 60 do the conversion.
| Variable | Type | Purpose |
|---|---|---|
| hours, minutes | int | data members of each object |
| total | int | parameter: a time in minutes |
| h, m | int | parameters: hours and minutes |
| t | int | minutes read in main |
| a, b, c | TimeSpan | one object per constructor |
| sc | Scanner | reads input from the keyboard |
Enter a time in minutes: 130 Enter hours and minutes: 1 95 0 h 0 min 2 h 10 min 2 h 35 min Difference = 25 min
95 minutes carries 1 hour, so 1 h 95 min is stored as 2 h 35 min, that is 155 minutes; 155 minus 130 is 25.
Bill and slab classes use exactly this skeleton with a different compute method; they are worked on ICSE Class 10 slab and bill programs, and every other program family is listed on ICSE Class 10 Java programs for practice.
Q4. What do constructor output questions test?
Constructor output questions check two facts: which constructor runs for a given new, and what value a member holds if nobody set it. Cover the Output column and trace each one first.
| # | Code | Output | Why |
|---|---|---|---|
| 1 | class Box { int n; double d; String s; boolean b; char c; }Box ob = new Box();System.out.println(ob.n + " " + ob.d + " " + ob.s + " " + ob.b + " " + (int) ob.c); | 0 0.0 null false 0 | No constructor written, so Java's empty one runs and every member keeps its default value |
| 2 | class Counter { static int made = 0; Counter() { made++; }}new Counter(); new Counter();Counter k = new Counter();System.out.println(Counter.made); | 3 | The constructor runs once per object, even for objects that are never stored in a variable |
| 3 | Point(int x, int y) { x = x; y = y; }Point p = new Point(3, 4);System.out.println(p.x + " " + p.y); | 0 0 | The parameters hide the data members, so each parameter is copied onto itself and the members stay 0 |
| 4 | Point2(int x, int y) { this.x = x; this.y = y; }Point2 q = new Point2(3, 4);System.out.println(q.x + " " + q.y); | 3 4 | this.x names the object's member; plain x names the parameter |
| 5 | Pen() { ...; System.out.print("A "); }Pen(String c) { ...; System.out.print("B "); }Pen(String c, int i) { ...; System.out.print("C "); }Pen p1 = new Pen("red");Pen p2 = new Pen();Pen p3 = new Pen("black", 40); | B A C | The order of the new statements decides the order; the argument list decides which version |
| 6 | Pen p4 = p3;p4.ink = 10;System.out.println(p3.ink); | 10 | No new, so no constructor runs and no new object exists: p4 and p3 name the same pen |
class Lamp {
int watts;
Lamp(int w) {
watts = w;
}
public static void main(String[] args) {
Lamp a = new Lamp(60);
Lamp b = new Lamp(); // line 8
System.out.println(a.watts);
}
}
// javac says:
Lamp.java:8: error: constructor Lamp in class Lamp cannot be applied to given types;
required: int
found: no arguments
Writing Lamp(int w) switched off the constructor Java would have supplied. Either write Lamp() as well, or always pass a value.
new runs, once per object.this. is used.More fragments to trace, sorted by trap, are on ICSE Computer Applications output questions, and code that will not compile has its own page: Java error finding questions.
Q5. What do Section A constructor questions look like?
These are original questions in the shapes Question 1 (one-mark MCQs) and Question 2 (two-mark answers) use. Write your answer before opening each one.
Kite? (a) void Kite() (b) Kite() (c) kite() (d) int Kite()
this.Car(int a) and Car(int b) in one class: will it compile?
String data member that no constructor sets?
Book(String t, int p) { title = t; pages = p; }, used as new Book("Kim", 320).Tank with members double litres and boolean full.
Tank() { litres = 0.0; full = false; }Shop(String n). Why does new Shop() fail, and give one fix.
Shop() { name = ""; }, or pass a name.Constructor items sit alongside every other chapter's one-mark questions on ICSE Computer Applications MCQ questions.
Q6. How is the Constructors chapter taught live?
Constructors are understood in one lesson and then cost marks for months: a stray void, a member never set, a parameter hiding a member. The weekly routine targets those slips.
At the 5:30 PM IST class each student defines a constructor, a default constructor and overloading in one sentence, and the group corrects the wording until it would earn the mark.
Short fragments like the six above are traced on paper, then run in BlueJ on a shared screen, so the default values and the order of constructors are seen, not just told.
At the 8:00 PM IST class a fresh Section B question is set. Students write the data members, the constructor, the methods, main and the variable description table by hand.
The mentor marks one answer in front of everyone: the constructor, each method, the object creation in main, the comments and the table each earn their share.
The corrected version goes into the student's lab assignments for internal assessment, and constructors return in the full two-hour mock papers from December.
With six students at most, every constructor a student writes is read and marked, not sampled.
Batch or personalised: you choose
Both formats use the same class-design questions, the same marking and the same BlueJ runs. In India a family can choose the evening mini batch or private classes; ICSE students living abroad are taught one to one. You pay monthly, and there is no admission fee.
Option 1 · Fixed batch timings
₹2,999
per month, two live classes a week
Option 2 · Choose your own timing
₹4,999
per month, one private class a weektwo private classes a week, at a time set with you
Outside India: the ICSE Computer Applications course runs as personalised one to one, two private classes a week at a time set in your own time zone. The mini batch is taught for families in India.
If your child can explain constructors but still writes void in front of them, or forgets to set a member, a short run of one to one classes usually fixes it. If the whole of Section B needs steady practice, the two batch evenings a week give more of it. Fees are shown in your local currency.
Studying outside India?
ICSE schools outside India take the same Computer Applications paper, so the same class-design questions and the same constructor traps decide their marks. Abroad, the chapter is taught one to one, early in the evening by the local clock.
| Where you live | Time difference | Usual class window, local time | Format |
|---|---|---|---|
| India (IST) every Indian city | IST | Tue 5:30 PM, Wed 8:00 PM | Mini batch or 1-on-1 |
| United Arab Emirates Dubai, Sharjah | 1 h 30 min behind India | 3:00 PM to 9:00 PM | Personalised 1-on-1 |
| Indonesia and Thailand West Java, Bangkok area | 1 h 30 min ahead of India | 3:30 PM to 9:00 PM | Personalised 1-on-1 |
| Singapore Singapore | 2 h 30 min ahead of India | 3:30 PM to 9:00 PM | Personalised 1-on-1 |
We fix the slot after the free demo and move it around school tests when needed. For how this works for families overseas, see ICSE Computer Applications classes in the Gulf and abroad.
What families say
Real reviews from real families. We neither write nor commission them.
★★★★★
"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."
Ria Mukherjee
Parent
★★★★★
"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."
Samriddha Mondal
Student
★★★★★
"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."
Vansh Agarwal
Student
★★★★★
"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."
Sonam Oswal
Parent of Dhairya
★★★★★
"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."
Sonu Goyal
Parent
★★★★★
"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."
Ritu Kedia
Parent
The rest of the Class 10 series
Every page in the ICSE Class 10 Computer Applications series, grouped by what you need: classes, each chapter, Section B programs, question practice, notes and revision, and the exam itself.
CBSE Class 10 AI (417): The Mon and Wed 9 PM AI batch CBSE AI 417 syllabus explained CBSE AI important questions Sample paper and mock tests
Questions about constructors
A constructor is a member method with the same name as its class and no return type, not even void. It runs automatically, once per object, when new creates the object, and gives the data members their starting values.
A constructor has the class's name, has no return type and runs automatically when an object is made. A method can have any name, must declare a return type such as void or int, and runs only when it is called with the object and a dot. Constructors initialise; methods do the work.
A parameterized constructor receives values through its parameters and copies them into the new object's data members, so each object can start with different values. For example, Book(String t, int p) stores a title and a page count, and is used as new Book("Kim", 320).
A default constructor takes no parameters and gives every data member a fixed starting value, such as 0 or an empty String. If a class has no constructor at all, Java adds an empty no-argument constructor, which leaves members at their default values: 0, 0.0, false or null.
Constructor overloading means writing more than one constructor in the same class, each with a different parameter list. A TimeSpan class can have TimeSpan(), TimeSpan(int total) and TimeSpan(int h, int m); Java chooses the one whose parameters match the arguments given with new.
No. Write any return type, even void, and Java treats it as an ordinary method that happens to share the class name. It compiles, but it does not run when the object is created: a favourite output-question trap.
Because Java supplies the empty no-argument constructor only when a class has no constructors at all. Once you write a parameterized one, new ClassName() has nothing to match. Write a default constructor as well, or always pass the values the constructor expects.
this refers to the object being created. When a parameter has the same name as a data member, as in Point(int x, int y), the plain name means the parameter, so this.x = x is needed to store the value in the member. Without this, the member stays at 0.
The 2027 syllabus wording for the chapter names the definition, characteristics, types and use of constructors, the default and parameterized constructor, constructor overloading and the difference from a method. Copy constructors are not named, so this page does not teach them for the exam.
Yes. In the mini batch, on Tuesday at 5:30 PM IST and Wednesday at 8:00 PM IST, students define, trace and then write full classes with constructors, which are marked on screen and run in BlueJ. Families who want a different time can choose personalised one to one classes.
Start
In the free demo your child defines a constructor in one line, traces three short constructor fragments, then writes the opening of a Section B class with the mentor watching. You come away knowing which parts of the chapter are secure and whether the mini batch or one to one suits your child.
Looking for the bigger picture? See ICSE Computer Applications important questions or the ICSE Class 10 Java classes.
WhatsApp us · +91 91233 66161 · connect@modernagecoders.com
Every class is live video. The form requests a callback and reserves nothing.
A full live class of about 45 to 60 minutes at a slot you pick, with a written skill report and learning roadmap on WhatsApp afterwards. The fee is adjusted against your first month if you enrol.
Book a priority demo