C code with output 6

int e = 2;
e += ++e;
printf("%d", e);

Java code with output 5

int e = 2;
e += ++e;
System.out.printf("%d", e);