Bifalgorithm post · Computer science one · Using Methods

What is a void method in Java?

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

Ideas in this flowchart

  • Méthodes Java utilisant le type void
  • Le mot-clé void indique qu’une méthode ne renvoie aucune valeur.
  • Une méthode qui ne renvoie aucune valeur est appelée une méthode void.
  • Même si elle n’est pas nécessaire, une instruction return reste une bonne pratique.
  • L’exemple définit une méthode sans paramètres d’entrée.
  • Déclaration : public static void printCopyright()
  • Affichage : System.out.println("(c) Bourke 2015");
  • Instruction de retour : 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\n1 public static void printCopyright()\n\n2 System.out.println(\"(c) Bourke 2015\");\n\n3 return;\n\n4 }\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.