Bifalgorithm post · Computer science one · Void Methods

What is a void method in Java?

What is a void method in Java? (Computer science one · Void Methods) — "The keyword void can be used in Java to indicate a method does not return a value, in w…

Ideas in this flowchart

  • Java void methods
  • The keyword void indicates that a method does not return a value.
  • A method with void as its return type is called a void method.
  • Although it is not necessary, including a return statement is good practice.
  • Example: public static void printCopyright()
  • The example method has no input parameters.
  • The method prints “(c) Bourke 2015”.
  • The example includes the statement return;.
Feed/

What is a void method in Java?

No cover

Channel

Computer science one

1 page

"The keyword void can be used in Java to indicate a method does not return a value, in which case it is called a “void method.” Though it is not necessary, it is still good practice to include a return statement.\n\npublic static void printCopyright()\n\nSystem.out.println(\"(c) Bourke 2015\");\n\nreturn;\n\n}\n\nIn the example above, we’ve also illustrated how to define a method that has no input parameters."

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.