Results 1 to 5 of 5
- 04-29-2010, 07:27 AM #1
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
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
_________________
Mine092606Last edited by mine0926; 04-29-2010 at 09:31 AM.
- 04-29-2010, 08:00 AM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
= does not mean the same thing as ==.
You used = where you wanted to use == instead in (LoginAttempt = 4).
- 04-29-2010, 08:20 AM #3
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
in my old programming language I use "=" and forgot that java uses "=="
Thanks for your reply. :)Last edited by mine0926; 04-29-2010 at 09:27 AM.
- 04-29-2010, 04:12 PM #4
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
Also consider LoginAttempt += 1 or LoginAttempt++.
-Gary-
- 04-30-2010, 01:44 AM #5
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
Similar Threads
-
1 as an integer, not boolean
By McChill in forum New To JavaReplies: 1Last Post: 05-02-2009, 09:39 PM -
Declare ListArray
By tommyyyy in forum New To JavaReplies: 1Last Post: 03-20-2009, 10:08 AM -
Requiring several database queries for my GUI
By matpj in forum New To JavaReplies: 0Last Post: 01-28-2009, 10:49 AM -
Why do I need to declare a new Scanner object here?
By Chase in forum New To JavaReplies: 3Last Post: 09-24-2008, 11:59 PM -
Declare methods in a class
By Adiel224 in forum New To JavaReplies: 5Last Post: 09-19-2008, 10:38 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks