mardi 30 mai 2017

Drawing a program graph: What line is visited after a conditional or loop is not called?

Just wanted to check whether the way I am thinking is correct. Here is an example method:

1 public static boolean isCircle (int M, int m) {
2     boolean result = false;
3     if (M == m & M > 0 & m > 0) {
4         result = true;
5     }
6     return result;
7     }

If I was to draw a program graph of this method (each line being a node, their path being edges) with variables that do not satisfy the conditional e.g. M = 1, m = 0. Would the program go from line 3 -> line 6, or from line 3 -> line 5 (end of the conditional). I would think line 3 to line 6 but am unsure.

Aucun commentaire:

Enregistrer un commentaire