Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Can anyone help me.. I cannot seem to get this menu looping

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can anyone help me.. I cannot seem to get this menu looping

    public class Test {
     
    	// This project is 3 parts. A menu which you can get to the other parts.
    	// There is then the printing pattern which 
     
    	/**
    	 * @param args
    	 */
     
    	public static void main(String[] args) 
    	{
    		if (args.length == 0)
    		{
    			boolean loop = false;
     
    			do {
    				//Initialising the Scanner which is 
    				//used to pick up the users input
    				Scanner sc = new Scanner(System.in);
     
    				//Menu - This is the menu in which you choose what
    				//	you want to do in the program
     
     
    				System.out.println("Menu");
    				System.out.println("a. Character Pattern");
    				System.out.println("b. Reverse Text");
    				System.out.println("x. Exit The Program");
    				String MenuIn = sc.nextLine();
    				System.out.println("You Chose " + MenuIn);
    				if (MenuIn.contentEquals("a")||MenuIn.contentEquals("A"))
    				{
    					Printingpatterns();
    				}
    				else
    				{
    					if (MenuIn.contentEquals("b")||MenuIn.contentEquals("B"))
    					{
    						Reverse();
    					}
    					else
    					{
    						if (MenuIn.contentEquals("x")||
    								MenuIn.contentEquals("X"))
    						{
    							System.exit(0);
    							loop = true;
    						}
    					}
    				}
    			} while (loop = false);
    		}
    	}
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,040
    Thanks
    52
    Thanked 2,280 Times in 2,251 Posts

    Default Re: Can anyone help me.. I cannot seem to get this menu looping

    } while (loop = false);
    Test for equality with ==

  3. #3
    Junior Member
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Can anyone help me.. I cannot seem to get this menu looping

    Quote Originally Posted by Norm View Post
    } while (loop = false);
    Test for equality with ==
    I knew there was something obvious wrong :/.. That's fixed it.. thank you

Similar Threads

  1. Array and Menu
    By nitwit3 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: July 21st, 2011, 06:46 PM
  2. Is it possible to use card layout for menu and menu items?
    By jai2rul in forum AWT / Java Swing
    Replies: 0
    Last Post: April 11th, 2011, 08:19 AM
  3. Menu of Menus Help
    By Strivelli in forum Java Theory & Questions
    Replies: 10
    Last Post: June 5th, 2010, 02:40 PM
  4. popup menu
    By antonio69 in forum AWT / Java Swing
    Replies: 1
    Last Post: May 20th, 2010, 04:24 AM
  5. Help with Menu/BinSearch
    By jhar131 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: April 19th, 2010, 07:38 PM