Skip to content

Instantly share code, notes, and snippets.

@bastienapp
Created March 5, 2019 09:46
Show Gist options
  • Save bastienapp/b46c17e3143e90cae23f6a762f7d235a to your computer and use it in GitHub Desktop.
Save bastienapp/b46c17e3143e90cae23f6a762f7d235a to your computer and use it in GitHub Desktop.
// nom de la class identique au fichier
class Hello {
// point d'entree de la class
// la methode main est execute au lancement de java Hello
public static void main(String[] args) {
//la variable resultat recoit le retour de l appel de la methode isEven
boolean resultat = isEven(7);
//affiche le contenu de la variable resultat
System.out.println(resultat);
}
// méthode qui retourne si le chiffre est pair
public static boolean isEven (int nombre) {
if (nombre%2==0){
return true;
} else {
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment