Results 1 to 3 of 3
- 08-09-2010, 11:41 AM #1
Member
- Join Date
- Feb 2010
- Posts
- 36
- Rep Power
- 0
small method isn't supposed to go under 0
hey everyone,
I have created a method like this:
aantalPas is a variable type int, initialized at 0.
The problem is that it keeps returning true even when it is 0 and you try to execute the method.
public boolean stapUit(){
boolean gelukt=false;
if(aantalPas>0)
aantalPas--;
gelukt=true;
return gelukt;}
- 08-09-2010, 11:49 AM #2
Member
- Join Date
- Feb 2010
- Posts
- 36
- Rep Power
- 0
stupid mistake from my side: brackets!
public boolean stapUit(){
boolean gelukt=false;
if(aantalPas>0.0){
aantalPas--;
gelukt=true;}
return gelukt;}
- 08-09-2010, 01:23 PM #3
Similar Threads
-
Values change when they're not supposed to
By m00nchile in forum New To JavaReplies: 7Last Post: 05-15-2010, 04:16 PM -
is this correct not supposed to edit the printValues method
By npm1 in forum Advanced JavaReplies: 1Last Post: 04-23-2010, 05:56 PM -
JButton doesn't disappear when it is supposed to?
By ecliptical in forum New To JavaReplies: 4Last Post: 01-25-2010, 12:41 AM -
Help interpreting what a class is supposed to do
By bornwithnoname in forum New To JavaReplies: 2Last Post: 11-20-2008, 12:19 AM -
Small problem
By ayoood in forum New To JavaReplies: 2Last Post: 06-06-2008, 12:27 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks