QUESTION IMAGE
Question
question 6
which of the following should be defined as a void method?
a write a method that converts an uppercase letter to lowercase.
b write a method that prints integers from 1 to 100.
c write a method that checks whether a number is from 1 to 100..
d write a method that returns a random integer from 1 to 100.
Brief Explanations
A void method is one that does not return a value.
- Option A: Converting a letter and returning the lowercase version would require a return type (e.g.,
char), so it's notvoid. - Option B: Printing integers (e.g., using
System.out.printlnin Java) does not need to return a value. This is a typical use case for avoidmethod. - Option C: Checking a condition would likely return a
boolean(e.g.,trueif the number is in the range,falseotherwise), so it's notvoid. - Option D: Returning a random integer would have a return type (e.g.,
int), so it's notvoid.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
B. Write a method that prints integers from 1 to 100.