• Post Reply Bookmark Topic Watch Topic
  • New Topic

Agruments as Options in JAVA  RSS feed

 
Harsha Gedala
Ranch Hand
Posts: 41
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I want to run a java class from command line where if i run the class it should ask me "press 1 for start and press 2 for cancel". And if i press 1 then it should start the program and ask me some more options like " press 1 for east, 2 for west, 3 for north and 4 for south".

I have done a class where it takes agruments


but i want to give the user to select the options that are available not like they have to give a try.

Please help me on this.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You simply print out a message telling them to type one of the options and then have a reader wait for user input.
 
Harsha Gedala
Ranch Hand
Posts: 41
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It worked. Thank you.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!