Void function does not return any value to the main function. *
True
False
Answers
Answered by
2
Answer:
Void function does not return any value to the main function-True.
Explanation:
PLEASE MARK AS BRAINIEST
Answered by
4
★
True ✔
★
public class Example {
public static void printHello() {
System.out.println("Hello!");
}
public static void main(String[] args) {
printHello(); // Call the void function
}
}
- In this example, the printHello() method is a void function that prints "Hello!" to the console.
- When we call printHello() from the main() method, it executes the code within the printHello() method, which prints "Hello!" to the console.
- Since printHello() does not return any value, we don't need to assign it to a variable or use it in any other way.
Similar questions