Methods - Basics QuizJ8 Home « Methods - Basics Quiz

Java Objects & Classes Quiz 5

The quiz below tests your knowledge of the material learnt in Objects & Classes - Lesson 5 - Methods - Basics.

Question 1 : Method declarations can have up to how many components?
- Method declarations can have up to 6 components (modifiers, return type, method name, parameter list, exception list and a method body).
Question 2 : The required elements of a method are the method name, a pair of parenthesis (), a body between braces {} and?
- Methods must have a <i>return type</i>.
Question 3 : Methods can be static or non-static?
- Methods CAN be static or non-static.
Question 4 : What return type is used when we don't want to return anything from a method?
- The <code>void</code> <i>return type</i> is used when we don't want to return anything from a method.
Question 5 : Methods can have multiple return types
- Methods CANNOT have multiple return types.
Question 6 : What are the method name and method parameters components collectively known as?
- Collectively the method name and method parameters components are known as the method signature.
Question 7 : We can add exception lists to our methods?
- We CAN add exception lists to our methods.
Quiz Progress Bar Please select an answer


What's Next?

The next quiz is about passing values to Java methods..