java return to specific point in program -
i have next question. have program has structure:
loadcontext(); showcategories(input); showprojects(input); showdetails();
on each step me user has ability jump previous step. example press 0 , program returns previos step. press 1 - program starts beginning. there instruments in java come specific point?
edit: have here console application. main method looks like:
loadcontext();//loads categories showcategories(input);//shows available categories , ask category show showprojects(input);// shows projects inside selested category , select project show in details showdetails();//show selected project
now want set option. example, in showprojects(input) put 0 , see again categories, select , see category. in showdetails() select 0 , show categories, select 1 , on.
you can this:
wrap 4 methods in method:
private void programstart(){ loadcontext(); showcategories(input); showprojects(input); showdetails(); }
then have method this:
private void processuserinput(int seloption) { if(seloption == 0){ showcategories(); } else if(seloption == 1){ programstart(); } else{ system.out.println("unsupported option"); } }
at end of each of methods want have option available:
a. read option users
b. callprocessuserinput(input)
input
Comments
Post a Comment