ICSE Class 10 Computer Applications Question 7 of 43

User-Defined Methods — Question 7

Back to all questions
7
Question

Question 7

When a function returns a value, the entire function call can be assigned to a variable. (T/F) ?

Answer

True

Example

class Demo
{
    int sum(int a, int b)   {
        int sum = a + b;
        return sum;
    }

    public static void main(String args[])  {
        Demo obj = new Demo();
        int ans = obj.sum(10, 20);
        System.out.println(ans);
    }
}