Q10
What is decomposition?
A design strategy that breaks a task down into several subtasks.
What is a driver program?
A program that does nothing but test a specific method.
Regular methods may be overloaded, but a constructor may not be overloaded. T or F?
False
Given the following constructors: public Rectangle(int width, double length) public Rectangle(double width, int length) which constructor will the following statement call? Rectangle rect = new Rectangle(4, 6)
Java will generate an error.
public int min(int num1, int num2) { if (num1 < num2) return num1 else if (num2 < num1) return num2 }
The method doesn't return a value in some cases.
Which of the following is not part of the signature of a method?
The return type of a method. The following IS part of the signature of a method: - The name of the method. - The number of parameters for a method. - The types of the parameters of a method.
A stub is a simplified version of a method that is sufficient for testing purposes. T or F?
True
Calling a method on a variable with a value of null will result in an error message. T or F?
True
Two methods may have the same name if they have a different number of arguments. T or F?
True
Given the following method header: public double computeArea(double length, double width) Which of the following would be a legal overloaded method in the same class?
public double computeArea(double length)