Essayez de calculer le résulat de l'appel de g avant d'exécuter le code
Created
September 12, 2023 13:02
-
-
Save nherbaut/854826874a588fb41e3bcbc6feafc03f to your computer and use it in GitHub Desktop.
L2.1.5 Les fonctions
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
| public class TypesL2 { | |
| static int myFunction(int x, int y) { | |
| int z = 2 * x - y; | |
| return z * x; | |
| } | |
| static int f(int n) { | |
| return 3 + myFunction(n, n + 1); | |
| } | |
| static int g() { | |
| int a; | |
| a = myFunction(3, 7); | |
| int b = f(a * a); | |
| return b; | |
| } | |
| public static void main(String... args) { | |
| int returnValue = g(); | |
| System.out.println(returnValue); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment