KnowledgeBoat Logo
|

Computer Applications

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

User Defined Methods

5 Likes

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);
    }
}

Answered By

2 Likes


Related Questions