Created
March 5, 2019 09:46
-
-
Save bastienapp/b46c17e3143e90cae23f6a762f7d235a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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