Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Java help

  • 28-11-2015 3:39pm
    #1
    Closed Accounts Posts: 191 ✭✭


    int count =1;
    int even ;
    int odd ;



    while (count <=5){
    String posNum = JOptionPane.showInputDialog("Enter a possitive value or -1 to quit");
    odd = Integer.parseInt(posNum);
    if (odd %2 !=0)
    JOptionPane.showMessageDialog(null,"The number is odd");
    else

    if (even %2 ==0)
    JOptionPane.showMessageDialog(null, "The number is even");
    count++;

    }

    JOptionPane.showMessageDialog(null, "The amount of even numbers is " + even);
    }
    }

    Hey, does anyone know why there is an error and it won't run? Thank you


Comments

  • Registered Users, Registered Users 2 Posts: 1,709 ✭✭✭wiz569


    I know feck all about java etc but would it be the curly braces at the end,you have two closed ones but no corresponding open ones?


  • Closed Accounts Posts: 191 ✭✭chocolate boy123


    No, my error is on the Int even in my if statement! I'm trying to figure out why! Thanks anyway


Advertisement