ICSE Class 10 Computer Applications Question 11 of 43

User-Defined Methods — Question 11

Back to all questions
11
Question

Question 9

Given the method below, write a main() method that includes everything necessary to call given method.

int thrice (int x)
{
return x * 3 ;
}
Answer
public class Methodcall
{
    int thrice (int x)
    {
        return x * 3 ;
    }
    
    public static void main(String args[])
    {
		Methodcall obj = new Methodcall();
        int ans;
        ans = obj.thrice(5);	
    }
}