Dependence cyclique A+B+C est different de C+B+A
Code:
1 2 3 4 5
| public interface InterfaceA
{
public static final int A = 2 * InterfaceB.B;
} |
Code:
1 2 3 4 5
| public interface InterfaceB
{
public static final int B = InterfaceC.C + 1;
} |
Code:
1 2 3 4 5
| public interface InterfaceC
{
public static final int C = InterfaceA.A + 1;
} |
Code:
1 2 3 4 5 6 7 8
| public class Main implements InterfaceA, InterfaceB, InterfaceC
{
public static void main (String [] args)
{
System.out.println (A + B + C);
}
} |
Ca affiche 7 chez moi. :roll:
Code:
1 2 3 4 5 6 7
| public class Main implements InterfaceA, InterfaceB, InterfaceC
{
public static void main (String [] args)
{
System.out.println (C + B + A); }
} |
Ca affiche 6 chez moi. :aie: :aie: :aie: :aie:
Quelqu'un peut m'expliquer ce comportement?
J'ai deja trouve qq explications peu convaincantes alors j'en voudrais d'autres.