Answer:
1. James will attack by generating a random private key XD and a corresponding public key YD.
2. Jane transmit YA to another person called Alex.
3. James intercept YA and transmit YD to jane.
4. Jane receive YD and calculate K1
At this point james and jane thinks they share a secret key but instead james has a secret key k1 to Jane and k2 to alex.
5. Alex transmit another key XA to alex for example.
6. James intercept and calculate k2 and vice versa.