I was making a basic nooby java tribe game, and I needed a way to return to main menu. Can anyone tell me of any methods? This is my current code (incomplete)
I want it to return to main menu if a certain number is entered after the stats are displayed.
import java.util.Random;
import java.util.Scanner;
public class SurvivalIsland {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner (System.in);
Scanner user_input = new Scanner( System.in );
int food;
int water;
int housing;
int tech;
int pop;
int atk;
int def;
int x;
int karma;
int farmlevel;
int choice;
food=1;
water=1;
housing=1;
tech=1;
pop=6;
atk=pop*tech;
def=pop*housing+tech;
String tribename;
System.out.print("Enter your tribe's name: ");
tribename = user_input.next( );
System.out.println("You are the leader of the "+tribename+" Tribe");
System.out.println("Enter 1 to See your tribes current stats");
System.out.println("Enter 2 to use action points");
System.out.println("Enter 3 to sleep");
choice = in.nextInt();
switch(choice)
{//switch
case 1:
{//case1
System.out.println("Your Tribes Stats");
System.out.println("Population ("+pop+")");
System.out.println("Water Supply ("+water+")");
System.out.println("Housing Level ("+housing+")");
System.out.println("Technological Level ("+tech+")");
System.out.println("Food Supply ("+food+")");
break;
}//case1
}//switch
}//main method
}