ICSE Class 10 · Computer Applications (Java) · User-defined methods 2027

Function overloading in ICSE Class 10, written the way the marks are given.

Function overloading in ICSE Class 10 means one class with several methods of the same name that differ in their parameters, and it is one of the most predictable Section B questions in Computer Applications. This page covers the whole user-defined methods chapter around it: prototype and signature, pure and impure methods, call by value and call by reference. Three overloading programs are worked in board format and were run in Java 21. In our live mini batch students write these against the clock and are marked on screen.

Live online · three overloading programs, run · which version Java picks · 15-mark checklist · first class free

Start here

Three courses that build on methods

Overloading answers are written and marked weekly on our BlueJ course for Classes 9 and 10. After the board, ISC Computer Science splits every program into methods, and a data structures course shows methods with clear inputs and outputs holding larger designs together.

Ans. The short version

Function overloading in ICSE Class 10 Computer Applications means defining two or more methods with the same name in one class, each with a different parameter list: a different number of parameters, different types, or a different order of types. Java decides which one to run from the arguments in the call. The return type alone cannot tell overloaded methods apart. Overloading is how the Class 10 syllabus shows polymorphism, and a Section B question often asks for three versions of one method plus a main method that calls them. Modern Age Coders teaches it live in a Tuesday and Wednesday mini batch in India, or one to one.

Q1. What are the parts of a user-defined method?

User defined methods ICSE: prototype, signature and parameters

A user-defined method is a named block of code written by the programmer, which can take values in through parameters and send one value back with return. Its first line is the prototype; its name with the parameter types is the signature.

One method, labelledheader and body
// prototype (method header):
public double area(double l, double b)
// access   return  name  formal parameters
// specifier type
{
    return l * b;     // body: sends one value back
}

// signature: area(double, double)
// a call with actual parameters:
double r = ob.area(7.5, 4);

The prototype includes the return type and the access specifier. The signature does not: it is only the name and the parameter types, in order. That difference is exactly why overloading cannot rely on return type.

TermPlain meaningIn the example
Method prototypeThe first line of a method: access, return type, name, parameter listpublic double area(double l, double b)
Method signatureThe name and the types of the parameters, in orderarea(double, double)
Formal parametersVariables in the header that receive valuesl, b
Actual parametersValues written in the call7.5, 4
Return typeType of the value sent back, or void for nonedouble
Static methodBelongs to the class; called without an objectMath.sqrt(16)
Non-static methodBelongs to each object; called through an objectob.area(7.5, 4)

Methods live inside a class, so this chapter leans on the one before it: class as the basis of all computation. Access specifiers such as public and private are covered on encapsulation and access specifiers.

Q2. What does an overloading answer look like?

Function overloading programs in ICSE board format

An overloading question names the class, names the method and describes each version. The answer is the class with every version written exactly as described, plus a main method that creates an object and calls each one. Below are three original questions in that shape, each with a full answer that was run.

Question A. Design a class Compute to overload a method work() as follows. (i) void work(int n): print the sum of the digits of n. (ii) void work(int a, int b): print the highest common factor of a and b. (iii) void work(String s): print the number of vowels in s. Write a main method to create an object and call all three.

Answer A: Computethree work() methods
class Compute {
    // sum of the digits of n
    void work(int n) {
        int sum = 0;
        while (n > 0) {
            sum += n % 10;
            n /= 10;
        }
        System.out.println("Digit sum = " + sum);
    }

    // highest common factor of a and b
    void work(int a, int b) {
        while (b != 0) {
            int r = a % b;
            a = b;
            b = r;
        }
        System.out.println("HCF = " + a);
    }

    // number of vowels in s
    void work(String s) {
        int v = 0;
        s = s.toUpperCase();
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if ("AEIOU".indexOf(ch) != -1)
                v++;
        }
        System.out.println("Vowels = " + v);
    }

    public static void main(String[] args) {
        Compute ob = new Compute();
        ob.work(4072);
        ob.work(84, 36);
        ob.work("Overloading");
    }
}
Outputone line per call
Digit sum = 13
HCF = 12
Vowels = 5

4 + 0 + 7 + 2 is 13. The HCF loop is Euclid's method: 84 and 36, then 36 and 12, then 12 and 0. "Overloading" has O, e, o, a and i.

CallArgumentsVersion run
ob.work(4072)one intwork(int)
ob.work(84, 36)two intswork(int, int)
ob.work("Overloading")one Stringwork(String)

Question B. Design a class Area with three overloaded methods double area(...): one parameter r returns the area of a circle (take pi as 3.14); two parameters return the area of a rectangle; three sides a, b, c return the area of a triangle by Heron's formula. Print each result from main.

Answer B: Areamethods that return
class Area {
    double area(double r) {
        return 3.14 * r * r;
    }

    double area(double l, double b) {
        return l * b;
    }

    double area(double a, double b, double c) {
        double s = (a + b + c) / 2;
        return Math.sqrt(s * (s - a) * (s - b) * (s - c));
    }

    public static void main(String[] args) {
        Area ob = new Area();
        System.out.println("Circle: " + ob.area(5));
        System.out.println("Rectangle: " + ob.area(7.5, 4));
        System.out.println("Triangle: " + ob.area(13, 14, 15));
    }
}

// Output
Circle: 78.5
Rectangle: 30.0
Triangle: 84.0

These are pure methods: they return a value and print nothing, so main does the printing. The int 5 is widened to double to match area(double).

Answer C: Seriesoverloading with series
// Question C. Overload void sum():
// sum(int n): 1 + 2 + ... + n
// sum(double x, int n): x/1 + x/2 + ... + x/n
class Series {
    void sum(int n) {
        int s = 0;
        for (int i = 1; i <= n; i++)
            s += i;
        System.out.println("Sum of first " + n + " numbers = " + s);
    }

    void sum(double x, int n) {
        double s = 0;
        for (int i = 1; i <= n; i++)
            s += x / i;
        System.out.println("Series sum = " + s);
    }

    public static void main(String[] args) {
        Series ob = new Series();
        ob.sum(10);
        ob.sum(6.0, 4);
    }
}

// Output
Sum of first 10 numbers = 55
Series sum = 12.5

6/1 + 6/2 + 6/3 + 6/4 = 6 + 3 + 2 + 1.5. Because x is double, x / i is real division.

Overloading questions very often wrap series or string tasks, so practise those bodies on their own as well: series programs in Java and ICSE Class 10 string programs.

Q3. Which overloaded version does Java call?

How Java chooses an overloaded method, and what is not overloading

Java first looks for a version whose parameter types match the arguments exactly. If there is none, it allows a widening conversion, such as char to int or int to double. If two versions fit equally well, the program does not compile.

Five versions of show()run in Java 21
static void show(int x)    { System.out.println("int " + x); }
static void show(double x) { System.out.println("double " + x); }
static void show(String x) { System.out.println("String " + x); }
static void show(int x, double y) { System.out.println("int,double " + (x + y)); }
static void show(double x, int y) { System.out.println("double,int " + (x * y)); }
CallOutputWhy
show(7)int 7Exact match for int
show(7.0)double 7.0Exact match for double
show('A')int 65No char version, so char widens to int, the nearest type
show(9L)double 9.0A long cannot shrink to int, but it can widen to double
show(5.0f)double 5.0float widens to double
show("7")String 7A String argument only fits the String version
show(2, 3.5)int,double 5.5The order of types picks the version
show(2.5, 4)double,int 10.0Same two types, other order, other version
Not overloading 1return type only
int val(int x) { return x; }
double val(int x) { return x; }

// javac: error: method val(int) is
// already defined in class RetOnly

Both have the signature val(int). A different return type does not make a different method.

Not compiling 2an ambiguous call
static void show(int x, double y) { }
static void show(double x, int y) { }
// ...
show(2, 3);

// javac: error: reference to show is ambiguous

Two ints fit both versions after one widening each, and neither is closer, so Java refuses to pick.

Questions that ask for the output of an overloaded call are traced on ICSE Java output questions, and comparisons such as pure versus impure or static versus non-static are collected on ICSE difference between questions. Constructors can be overloaded with the same rules; that chapter is on ICSE Class 10 constructors questions.

Q4. What are pure and impure methods, and how are values passed?

Pure and impure methods, call by value and call by reference in ICSE

A pure method returns a result that depends only on its parameters and changes nothing outside itself. An impure method changes something outside itself, such as a data member of the object or an array it was given. The syllabus asks for pass by value with programs, and pass by reference as a definition with an example.

PureImpureone of each
class PureImpure {
    int total = 0;

    // pure: uses only its parameter, changes nothing outside
    int cube(int x) {
        return x * x * x;
    }

    // impure: changes the object's data member
    void addScore(int s) {
        total = total + s;
    }

    public static void main(String[] args) {
        PureImpure ob = new PureImpure();
        System.out.println(ob.cube(3) + " " + ob.cube(3));
        ob.addScore(40);
        ob.addScore(25);
        System.out.println("total = " + ob.total);
    }
}

// Output
27 27
total = 65

Calling cube(3) twice gives 27 twice and nothing else changes. Each call to addScore leaves the object different, which is what makes it impure.

Passingvalue and reference
class Passing {
    static void swap(int a, int b) {
        int t = a;
        a = b;
        b = t;
        System.out.println("Inside: a = " + a + ", b = " + b);
    }

    static void doubleAll(int[] arr) {
        for (int i = 0; i < arr.length; i++)
            arr[i] = arr[i] * 2;
    }

    public static void main(String[] args) {
        int a = 30, b = 50;
        swap(a, b);
        System.out.println("After: a = " + a + ", b = " + b);
        int[] m = {3, 5, 7};
        doubleAll(m);
        System.out.println(m[0] + " " + m[1] + " " + m[2]);
    }
}

// Output
Inside: a = 50, b = 30
After: a = 30, b = 50
6 10 14

swap works on copies of 30 and 50, so main's variables do not change. doubleAll receives a reference to the same array, so its changes are seen in main.

PointCall (pass) by valueCall (pass) by reference
What the method receivesA copy of the valueA reference to the same object or array
Types passed this wayPrimitive types: int, double, char, boolean and the restReference types: arrays and objects
Change inside the methodNot seen by the callerChanges to the object's contents are seen by the caller
Example aboveswap(a, b)doubleAll(m)

Strictly, Java copies the reference itself, which is why assigning a new String or a new array to a parameter does not affect the caller. In the ICSE answer, the definitions in the table are what is expected. Ready-to-learn versions of these definitions are in ICSE Computer Applications chapter-wise notes.

Q5. How is an overloading question marked?

A marking checklist for a 15-mark overloading question

An overloading answer is easy to get mostly right and annoyingly easy to lose marks on. Tick these seven points before moving to the next question. They are the points our teachers mark against in class.

Common slipResult
Two versions differ only in return typeDoes not compile: "already defined"
Method declared inside mainDoes not compile (illegal start of expression): a method cannot be defined inside another method
Non-static method called from main without an objectDoes not compile: non-static method cannot be referenced from a static context
Missing return in a non-void versionDoes not compile: missing return statement
Digit loop changes n, then n is printed in the messagePrints 0 instead of the number the user gave

The same checklist idea, applied to every kind of Section B answer, is on how to score 100 in ICSE Computer Applications.

Q6. How is this chapter taught live?

Methods and overloading in the mini batch

The chapter is learnt by calling methods, watching which version runs, and writing full answers that are ticked against the checklist.

  1. Tuesday: guess the version

    At the 5:30 PM IST class students see a set of overloaded headers and a list of calls, and write which version each call runs before BlueJ settles it.

  2. Tuesday: pure or impure?

    Short methods are sorted into pure and impure, and value or reference, out loud, so the theory answers come out in the student's own words.

  3. Wednesday: one overloading question, timed

    At the 8:00 PM IST class an original question in board shape is answered on paper in about 20 minutes, then typed and run.

  4. Ticked on screen

    The teacher marks each answer against the seven points with the student watching, and the missed point becomes the first thing checked next week.

  5. Viva and mocks

    Prototype, signature and overloading are favourite oral questions, so they are rehearsed before internal assessment, and overloading appears in the full two-hour mocks from December.

The oral side is covered on ICSE Computer Applications viva questions.

Batch or personalised: you choose

Learn methods and overloading in the mini batch, or one to one

Whichever format you pick, your child gets the same overloading questions, the same drills on which version Java calls and the same seven-point checklist. An Indian family may take the two fixed evenings or a private hour; overseas, only private classes are offered. Billing is month to month 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
  • No more than six ICSE Class 10 students
  • Overloaded calls predicted, then run in BlueJ
  • A timed overloading answer each Wednesday
  • Every answer ticked against the checklist
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 sets, in India or abroad
  • Focus on whichever checklist point keeps slipping
  • Theory definitions rehearsed until they are exact
  • Harder overloading questions as confidence grows
  • Checklist and programs identical to the batch
Ask for a personalised plan

A student who writes working methods but loses marks on names, signatures or a missing main usually needs only a few one to one sessions with the checklist. A student still unsure how parameters and return values work does better with the steady rhythm of two batch classes a week. Fees show in your own currency.

Studying outside India?

Learning methods and overloading from outside India

A CISCE school in the Gulf or South East Asia writes the very same Computer Applications paper, and an overloading program is worth just as much there. Families abroad get private classes, timed to fit after the local school day.

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 agree the hour once the free demo is done, and shift it when school tests get in the way. More detail for overseas families is on 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 methods and overloading

What students ask about function overloading and user-defined methods

What is function overloading in Java ICSE Class 10?

Function overloading means writing two or more methods with the same name in one class, where each has a different parameter list: a different number of parameters, different types, or the same types in a different order. Java picks the version to run by matching the arguments in the call. It is how the Class 10 syllabus shows polymorphism.

Can methods be overloaded by changing only the return type?

No. Java tells methods apart by their signature, which is the name and the parameter types. Two methods with the same name and parameters but different return types have the same signature, so javac reports that the method is already defined. The parameter list must differ.

What is the difference between a method prototype and a method signature?

The prototype is the whole first line of the method: access specifier, return type, name and parameter list, for example public double area(double l, double b). The signature is only the name and the parameter types in order, area(double, double). Overloaded methods must have different signatures.

What is the difference between pure and impure methods?

A pure method returns a value that depends only on its parameters and does not change anything outside itself, so calling it twice with the same arguments gives the same result. An impure method changes something outside itself, such as a data member of the object or the contents of an array passed to it.

What is call by value and call by reference in ICSE?

In call by value the method receives a copy of a primitive value, so changes inside the method do not affect the caller. In call by reference the method receives a reference to an object or array, so changes made to its contents are seen by the caller. The syllabus asks for call by value with programs and call by reference as a definition with an example.

What are actual and formal parameters?

Formal parameters are the variables named in the method header that receive values, such as l and b in area(double l, double b). Actual parameters are the values or variables written in the call, such as 7.5 and 4 in ob.area(7.5, 4). Their number, types and order must match a version of the method.

Which method is called if there is no exact match for the argument?

Java widens the argument to the nearest type that has a version. A char argument goes to an int version before a double one, and a long or float argument goes to a double version. If two versions fit equally well after widening, the call is ambiguous and the program does not compile.

What is the difference between static and non-static methods?

A static method belongs to the class and can be called without creating an object, like Math.sqrt. A non-static method belongs to each object and is called through an object, like ob.work(5). Calling a non-static method directly from the static main method, without an object, does not compile.

How many marks is a function overloading question in ICSE?

An overloading program is usually set as a full Section B question, and each Section B question carries 15 marks; students answer any four of the six. Overloading also appears in Section A as short theory or output questions about which version is called.

Do you teach user-defined methods in live classes?

Yes. In the ICSE mini batch on Tuesday at 5:30 PM and Wednesday at 8:00 PM IST, students predict which overloaded version runs, write a timed overloading answer and have it marked against a checklist on screen. Families who need another time can choose personalised one to one classes.

Start

Try a free live class on methods and overloading

In the free demo your child predicts which overloaded method each call will run, writes one version of an overloading question with the mentor, and runs it in BlueJ. Afterwards you hear which parts of the methods chapter are secure and which need work, and whether the mini batch or one to one fits better.

Prefer to see the whole subject first? Look at 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