MCQ Single Best Answer Easy

QYou are to complete the code needed to create a method within a class. Your method will NOT return information. Which will best complete this statement?

public __________ myMethodName 

ID: #9376 Module 13: Classes 176 views
Question Info
#9376Q ID
EasyDifficulty
Module 13: ClassesTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A void
  • B null
  • C str
  • D return
Correct Answer: Option A

Explanation

Justification:

  1. The void keyword is used before a method name to indicate that the given method does not return a value.
  2. The null keyword is not used for specifying whether a method returns a value or not.
  3. Placing the “str” keyword before the method name implies that it will be returning a value of type string.
  4. Return is not a valid keyword to be used before a method.

 

Related Lesson: Create a Base Class

No Previous Next Question

Share This Question

Challenge a friend or share with your study group.