Question

In: Computer Science

Suppose your method does not return a value. Which of the following is true? Group of...

Suppose your method does not return a value. Which of the following is true?

Group of answer choices:

A - You write no word for the return type.

B - Your return type should be void.

C - You write none as the return type.

D - You write public as the return type.

Solutions

Expert Solution

B) Your return type should be void

----------------------

Explanation:

When a method doesn't return any value, the return type should be void,
void indicates that nothing will be returned by the method.

Example:

In the above code, the printMsg function doesn't return anything. Therefore we used void printMsg to declare the method name.
Options A, C, D are incorrect and they would produce a compiler error

B) Your return type should be void

---------------------------------------------------------------------------------------
Please give a thumbs up if you find this answer helpful.
If it doesn't help, please comment before giving a thumbs down.
Please Do comment if you need any clarification.
I will surely help you.

Thankyou


Related Solutions

true or false C++ a.    (T or F)   A function or method cannot return a value of type...
true or false C++ a.    (T or F)   A function or method cannot return a value of type array. b.    (T or F)   C++ throws an exception if you try to refer to element 47 in an array with 20 elements. c.    (T or F)   I can copy one array to another by simply using an assignment statement which assigns the one array to the other. d.    (T or F)  An exception is the occurrence of an erroneous or unexpected situation during the execution of a program. e.    (T...
For a growing firm, which depreciation method results in the highest return on assets (ROA)? Group...
For a growing firm, which depreciation method results in the highest return on assets (ROA)? Group of answer choices A) Double declining balance. B) Straight line. C) ROA is the same under all methods.
public class AllEqual { // You must define the allEqual method, which will return // true...
public class AllEqual { // You must define the allEqual method, which will return // true if either: // 1.) The given array contains fewer than two elements, or... // 2.) All elements of the array are equal to each other. // As a hint, you only need to compare the first element // to all subsequent elements for this check. // // TODO - define your code below this comment // // DO NOT MODIFY parseStrings! public static int[]...
Write a RECURSIVE method that receives a string as a parameter. The method will return true...
Write a RECURSIVE method that receives a string as a parameter. The method will return true if the string received as a parameter is a palindrome and false if it is not. The method must not have any loops! In JAVA
Which of the following is NOT true? Group of answer choices Compared to this year, a...
Which of the following is NOT true? Group of answer choices Compared to this year, a discount bond’s price will increase next year, everything else equal. Compared to this year, a premium bond’s price will decrease next year, everything else equal. Compared to this year, a par bond’s price will remain constant next year, everything else equal. Compared to this year, a premium bond’s price will increase next year, everything else equal.
In physics, which of the following is true? Group of answer choices The weight of an...
In physics, which of the following is true? Group of answer choices The weight of an object depends on where the measurement takes place. In mechanics, weight and mass measure the same property of matter. In mechanics, the kilogram is an acceptable unit of force, as long as it is used to describe weight. Mass and weight are both vector quantities.
Which of the following statements involving the promised return on a loan is NOT true?
Which of the following statements involving the promised return on a loan is NOT true?Credit risk may be the most important factor affecting the return on a loan.Compensating balances reduce the effective cost of loans for the borrower because the deposit interest rate is typically greater than the loan rate.Compensating balances represents the portion of the loan that must be kept on deposit at the bank.Compensating balance requirements provide an additional source of return for the lending institution.Increased collateral is...
Which of the following statements involving the promised return on a loan is NOT true?
Which of the following statements involving the promised return on a loan is NOT true?Credit risk may be the most important factor affecting the return on a loan.Compensating balances reduce the effective cost of loans for the borrower because the deposit interest rate is typically greater than the loan rate.Compensating balances represents the portion of the loan that must be kept on deposit at the bank.Compensating balance requirements provide an additional source of return for the lending institution.Increased collateral is...
Which of the following is true regarding a sale or return as compared to a sale...
Which of the following is true regarding a sale or return as compared to a sale on approval? Multiple Choice In a sale on approval, unless the parties agree to the contrary, title and risk of loss rest with the buyer on delivery. In a sale or return, title and risk of loss rest with the buyer on delivery; and the parties have no option to change the rule by agreement. In a sale on approval, title and risk of...
1. Which of the following is a method that can be called on a list? Group...
1. Which of the following is a method that can be called on a list? Group of answer choices split() lower() strip() All of the above methods can be called on a list None of the above 2. Which one of these correctly reads a value from the keyboard into variable x?   Group of answer choices input(x) readline(x) x = input() x = readline() 3. What happens if you run the following code?   x = input("Enter a value: ") if...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT