ICSE Class 10 · Computer Applications (Java) · Constructors 2027

Constructors ICSE Class 10 questions, with every answer run in Java.

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

Courses that teach constructors properly

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.

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?

What is a constructor? Definitions for ICSE Class 10 in one sentence each

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.

TermOne-sentence definitionSmallest example
ConstructorA 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 constructorA constructor with no parameters, which gives every data member a fixed starting value.Pen() { colour = "blue"; ink = 100; }
Parameterized constructorA 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 constructorIf 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 overloadingDefining 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 keywordA reference to the current object, used inside a constructor when a parameter has the same name as a data member.this.x = x;

Characteristics of a constructor (the list examiners mark)

  1. Its name is exactly the class name, with the same capital letters.
  2. It has no return type, not even void. Add one and it stops being a constructor.
  3. It is called automatically, once, when new creates the object; you never call it with a dot.
  4. It is usually declared public so objects can be created from outside the class.
  5. It can be overloaded, but a class cannot have two constructors with the same parameter list.
  6. Once you write any constructor yourself, Java no longer supplies the empty one.

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?

Difference between constructor and method, ICSE style

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.

PointConstructorMethod
NameSame as the classAny valid identifier
Return typeNone, not even voidMust have one, void or a data type
How it runsAutomatically, when new creates an objectOnly when called, as ob.show()
How many times per objectOnce, at creationAs many times as it is called
PurposeTo initialise the data membersTo carry out a task on the data
If none is writtenJava supplies an empty no-argument oneNothing is supplied

Default constructor versus parameterized constructor

PointDefault (no-argument)Parameterized
ParametersNoneOne or more
Starting valuesThe same for every objectDifferent for each object, sent in by the caller
Object creationnew Pen()new Pen("black", 40)
Supplied by Java?Yes, if no constructor is writtenNever; you must write it
Trap: a return type makes it a methodcompiles and runs
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.

Trap: void Demo() is not a constructorcompiles and runs
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?

Parameterized and default constructor programs in Java for ICSE

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.

ExamResult.javadefault constructor
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.

VariableTypePurpose
nameStringstudent's name
eng, maths, compintmarks in the three subjects
avgdoubleaverage of the three marks
gradechargrade decided from avg
scScannerreads input from the keyboard
obExamResultthe object created in main
Sample runJava 21
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.

TimeSpan.javaconstructor overloading
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.

VariableTypePurpose
hours, minutesintdata members of each object
totalintparameter: a time in minutes
h, mintparameters: hours and minutes
tintminutes read in main
a, b, cTimeSpanone object per constructor
scScannerreads input from the keyboard
Sample runJava 21
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 overloading and default values: output questions

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.

#CodeOutputWhy
1class 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 0No constructor written, so Java's empty one runs and every member keeps its default value
2class Counter {
  static int made = 0;
  Counter() { made++; }
}
new Counter(); new Counter();
Counter k = new Counter();
System.out.println(Counter.made);
3The constructor runs once per object, even for objects that are never stored in a variable
3Point(int x, int y) { x = x; y = y; }
Point p = new Point(3, 4);
System.out.println(p.x + " " + p.y);
0 0The parameters hide the data members, so each parameter is copied onto itself and the members stay 0
4Point2(int x, int y) { this.x = x; this.y = y; }
Point2 q = new Point2(3, 4);
System.out.println(q.x + " " + q.y);
3 4this.x names the object's member; plain x names the parameter
5Pen() { ...; 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 CThe order of the new statements decides the order; the argument list decides which version
6Pen p4 = p3;
p4.ink = 10;
System.out.println(p3.ink);
10No new, so no constructor runs and no new object exists: p4 and p3 name the same pen
Error: the missing no-argument constructorjavac 21
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.

Four rules that settle every constructor trap

  1. A constructor runs only when new runs, once per object.
  2. Members not set by the constructor keep their defaults: 0, 0.0, false, null, and the character with code 0.
  3. If any constructor is written, the free no-argument one disappears.
  4. A parameter with the same name as a member hides it, unless 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?

Constructors ICSE Class 10 questions with answers for Section A

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.

One-mark questions

  1. Which of these can be a constructor of class Kite? (a) void Kite() (b) Kite() (c) kite() (d) int Kite()
    Answer (b). No return type, and the name matches the class exactly, including the capital K.
  2. The constructor Java supplies when none is written takes how many parameters?
    Answer None. It is a no-argument constructor that leaves the members at their default values.
  3. Which keyword refers to the object whose constructor is running?
    Answer this.
  4. Two constructors Car(int a) and Car(int b) in one class: will it compile?
    Answer No. Parameter names do not count; both have the parameter list (int), so the class has the same constructor twice.
  5. What is the default value of a String data member that no constructor sets?
    Answer The value null, meaning the member does not refer to any String yet.

Two-mark questions

  1. State two differences between a constructor and a method.
    Answer A constructor has the same name as the class and no return type; a method has any name and must declare a return type. A constructor runs automatically when an object is created; a method runs only when it is called.
  2. What is a parameterized constructor? Give an example.
    Answer A constructor that receives values through parameters and stores them in the data members. Example: Book(String t, int p) { title = t; pages = p; }, used as new Book("Kim", 320).
  3. Write a default constructor for class Tank with members double litres and boolean full.
    Answer Tank() { litres = 0.0; full = false; }
  4. What is constructor overloading? Why is it useful?
    Answer Defining several constructors in one class that differ in their parameter lists. It lets objects be created in different ways, for example with default values or with values supplied by the user.
  5. A class has only Shop(String n). Why does new Shop() fail, and give one fix.
    Answer Once a constructor is written, Java does not supply the no-argument one, so no constructor matches an empty argument list. Fix: add 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?

How the mini batch turns constructors into marks

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.

  1. Definitions said aloud on Tuesday

    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.

  2. Traps traced against a timer

    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.

  3. A full class designed on Wednesday

    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.

  4. Marked against the scheme on screen

    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.

  5. Lab file and mock papers

    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

Learn constructors in the mini batch, or one to one

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

Mini batch, Tuesday 5:30 PM and Wednesday 8 PM

₹2,999

per month, two live classes a week

  • Tuesday 5:30 PM and Wednesday 8:00 PM IST, live
  • Six ICSE Class 10 students at most
  • Constructor definitions corrected word by word
  • A Section B class written and marked each fortnight
  • Traps run in BlueJ while the group watches
Book a free demo in this batch

Option 2 · Choose your own timing

Personalised one to one

₹4,999

per month, one private class a week, at a time set with you

  • A time the family picks, in India or overseas
  • Extra classes on the exact slips your child makes
  • Class designs built together, then alone
  • Harder ISC-style classes once the basics hold
  • Same mentors, same 2027 syllabus, same marking
Ask for a personalised plan

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?

Constructors practice for ICSE students abroad

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 liveTime differenceUsual class window, local timeFormat
India (IST)
every Indian city
ISTTue 5:30 PM, Wed 8:00 PMMini batch or 1-on-1
United Arab Emirates
Dubai, Sharjah
1 h 30 min behind India3:00 PM to 9:00 PMPersonalised 1-on-1
Indonesia and Thailand
West Java, Bangkok area
1 h 30 min ahead of India3:30 PM to 9:00 PMPersonalised 1-on-1
Singapore
Singapore
2 h 30 min ahead of India3:30 PM to 9:00 PMPersonalised 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

Rated 4.9 across 547 Google reviews

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

More pages for Class 10 board students

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

What students ask about constructors in ICSE Class 10

What is a constructor in Java ICSE Class 10?

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.

What is the difference between a constructor and a method?

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.

What is a parameterized constructor in ICSE?

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).

What is a default constructor in Java for ICSE?

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.

What is constructor overloading with an example?

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.

Can a constructor have a return type?

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.

Why does new ClassName() give an error when I have written a constructor?

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.

What is the use of the this keyword in a constructor?

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.

Are copy constructors in the ICSE 2027 syllabus?

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.

Do you teach the Constructors chapter in live classes?

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

Try a free live class on constructors

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.

We call within a few hours. No card, no enrolment fee.

Want it sooner? Book a priority demo

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

Keep exploring Modern Age Coders

By class and age

Learn more

Free resources

From the blog

Start here