1A return statement without any value can be used in 2 If

1.A return statement without any value can be used in _______.

2.

.

If a method does not contain any parameters, you must invoke it with a pair of empty parentheses.

True
False

3. The actual parameters of a method must match the formal parameters in type, order, and number.

True
False

4. A call for the method with a void return type is always a statement itself, but a call for the method with a non-void return type can be treated as either a statement or an expression.

True
False

5. A method can be declared with no parameters.

True
False

6. A method can be defined inside a method in Java.

True
False

7. A variable or a value listed in a call to a method is called

8. A variable that is declared inside a method is called ________ variable.

9. A _____ method does not return a value.

10. Each Java class must contain a main method.

True
False

11. Java allows you to declare methods with the same name in a class. This is called ________.

12. Methods can be declared in any order in a class.

True
False

13. The modifiers and return value type do not contribute toward distinguishing one method from another, only the parameter list.

True
False

14. The signature of a method consists of the method name, parameter list and return type.

True
False

15. Variables defined in the method header are called _____.

16. Variables defined inside a method are called _____.

17. Which of the following is not an advantage of using methods.

Using methods makes reusing code easier.

18. You can define two methods in the same class with the same name and parameter list.

True
False

19. You can redeclare the variable if it is declared in the method signature.

True
False

20. You may have a return statement in a void method.

True
False

21. You must have a return statement in a non-void method.

True
False

A. a non-void method
B. void method
C. Is an error.

Solution

B TRUE TRUE TRUE TRUE FALSE D A B FALSE D TRUE TRUE TRUE C A C FALSE TRUE TRUE TRUE
1.A return statement without any value can be used in _______. 2. . If a method does not contain any parameters, you must invoke it with a pair of empty parenth
1.A return statement without any value can be used in _______. 2. . If a method does not contain any parameters, you must invoke it with a pair of empty parenth

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site