Results 1 to 5 of 5
  1. #1
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

    Default Declare INTEGER expecting/requiring BOOLEAN [SOLVED]

    Hi,
    So this is my first post. I am studied java 2yrs ago so now I am "back to basic". This is actually a begginer question.
    I might use non technical terms in java or in programming language.
    I declare an int called LoginAttempt, i put it inside class frmLogin so that it will not reset whenever I click the Login button and also I want to add 1 everytime the user click the Login button.
    That part was fine but when i use IF the netbeans return an error message telling that it required boolean.
    Please see the code.
    Java Code:
        int LoginAttempt = 0; 
        private void cmdLoginMouseClicked(java.awt.event.MouseEvent evt) { 
            LoginAttempt = LoginAttempt + 1; 
            if (LoginAttempt = 4) { 
                jLabel1.setText("NO"); 
            } 
        }

    Thanks in advance
    geje
    _________________
    Mine092606
    Last edited by mine0926; 04-29-2010 at 10:31 AM.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    = does not mean the same thing as ==.
    You used = where you wanted to use == instead in (LoginAttempt = 4).

  3. #3
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

    Default

    in my old programming language I use "=" and forgot that java uses "=="
    Thanks for your reply. :)
    Last edited by mine0926; 04-29-2010 at 10:27 AM.

  4. #4
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    952
    Rep Power
    5

    Default

    Also consider LoginAttempt += 1 or LoginAttempt++.

    -Gary-

  5. #5
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

Similar Threads

  1. 1 as an integer, not boolean
    By McChill in forum New To Java
    Replies: 1
    Last Post: 05-02-2009, 10:39 PM
  2. Declare ListArray
    By tommyyyy in forum New To Java
    Replies: 1
    Last Post: 03-20-2009, 11:08 AM
  3. Requiring several database queries for my GUI
    By matpj in forum New To Java
    Replies: 0
    Last Post: 01-28-2009, 11:49 AM
  4. Replies: 3
    Last Post: 09-25-2008, 12:59 AM
  5. Declare methods in a class
    By Adiel224 in forum New To Java
    Replies: 5
    Last Post: 09-19-2008, 11:38 AM

Posting Permissions

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