Is there any way of executing the already executed code in java.
for example in the main method i have int variable a = 10; and later point in time say suppose at the end of execution i will check some conditions on its(a’s) value and if the condition fails then i want it to execute from the beginning.
there may be some other scenarios also, right now i have this.
Edit: without looping and methods. which i know.
like goto statements in c++. and dont think only for the above stated example there might be some other example which might need the way i wanted.
why can’t you just do something like this?
EDIT: if you can’t use a proper loop construct, then recursion is your only real choice.. something like this: