Computer Science, asked by chauhansanjay1611, 1 year ago

Void function does not return any value to the main function. *

True

False

Answers

Answered by queen429786
2

Answer:

Void function does not return any value to the main function-True.

Explanation:

PLEASE MARK AS BRAINIEST

Answered by purveshKolhe
4

\bf{\underline{Answer::}}

True ✔

\rule{300pt}{0.2em}

\bf{\underline{Example::}}

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.

\rule{300pt}{0.2em}

Similar questions