Skip to content

Instantly share code, notes, and snippets.

@TPei
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TPei/889799e1196c0f52cceb to your computer and use it in GitHub Desktop.
Save TPei/889799e1196c0f52cceb to your computer and use it in GitHub Desktop.
public class Methoden {
public static void main(String[] args){
// da kein return Wert, brauchen wir auch nichts speichern
ausgeben("Hallo Ausgabe");
// da keine Argumente erwartet, uebergeben wir auch keine
int zahl = gibDrei();
System.out.println(zahl);
}
// neue Methoden
// public static rückgabeTyp name(Datentyp argument, Datentyp argument2, ...)
// kein wiedergabewert, erhaelt text zur ausgabe
public static void ausgeben(String text){
System.out.println(text);
}
// gibt int zurueck, erwartet kein Argument
public static int gibDrei(){
return 3;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment