In: Computer Science
Given the following method declaration, write a valid method call.
public static void calcArea(String roomName, int length, int
width)
CLASSNAME.calcArea("Conference Room",100,200)
Explanation:
Static method should be called as CLASSNAME.METHODNAME
roomName is of type string: so we should pass string when calling this function.
length is of type int so we should pass an integer when calling this function.
width is of type int so we should pass an integer when calling this function.
Sample Program:
public class Main
{
public static void calcArea(String roomName, int length, int
width)
{
System.out.println("Area of "+roomName+" = "+(length*width));
}
public static void main(String[] args)
{
Main.calcArea("Conference Room",100,200);
}
}