For example, two source codes are written in a way that both of them return a number and print out a random string(for example:"I have died number times") that number times. The important point in here is that the number that is returned from one program is the number that is added to the other program's string. One thing that should also be considered is that both programs hypothetically intervene others source code and then runs it forever. Which means the return value of the one program is actually the main factor to manipulate the other program.
Question: Is it doable,(for example in java) if so can a program alter its own source code?