Results 1 to 2 of 2
  1. #1
    mnand is offline Member
    Join Date
    Feb 2009
    Posts
    1
    Rep Power
    0

    Default Menu Options For User

    I'm trying to create a menu where the user can choose from two options but it doesn't seem to be working:

    BufferedReader cin = new BufferedReader (new InputStreamReader(System.in));

    double [] grades = new double [20];

    double students, mean, stdev;
    int A, B, C, D, F;

    String menu;

    System.out.println ("JAVA GRADEBOOK \n");
    System.out.println("Q - Quit \nG - Gradebook");

    menu = cin.readLine();
    if (menu == "Q") {
    System.out.println("Bye");
    }

    Is this the right way to check if a string is a certain value?

    Thanks,

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Replies: 1
    Last Post: 07-13-2008, 04:16 PM
  2. Fill a menu dynamically when menu is shown
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-07-2008, 05:47 PM
  3. React to menu action and checkbox menu
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 08:50 PM
  4. Replies: 7
    Last Post: 05-09-2008, 08:54 AM
  5. How to set General options in NetBeans IDE
    By JavaForums in forum NetBeans
    Replies: 0
    Last Post: 08-02-2007, 01:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •