public static void main(String[] args)
{
Takes 5 arguments on the command line (args0,..., args4).
Executes a method called startGame with those args as
parameters.
}
public static void startGame(int args0,..., int args4)
{
Asks the person to press a key and the program does different things
depending on what key is pressed.
If he presses 'p', the game must restart,
which means that this current method must
stop and restart with the same parameters.
}
This is an ongoing problem for me. Whenever I have a problem in Java, it's always because a method cannot return more than one thing. I wanted to do something like:
if (keypressed.equalsIgnoreCase("p"))
return; // To stop the current execution of
this method
But then what? It's not gonna do anything after that. I wanna go back to my main method and tell it to keep executing the startGame method, but I really don't know if that's possible.
This post has been edited by jon.kiparsky: 18 March 2012 - 12:53 PM
Reason for edit:: Added code tags

New Topic/Question
Reply




MultiQuote




|