Click to See Complete Forum and Search --> : if statement
AlnavPlatinum
Nov 21st, 2006, 07:30 PM
Hi all,
I am having problem with a simple If statement:
if(Value>0.0)
{
stack.push(Pj);
stack.push(Pi);
stack.push(Pt);
}
else
stack.push(convex.get(i));
Value is greater(double) then 0.0. After it goes "if statement", it continues to goes through "else". Event though the Value is greater than 0.0.
Thanks!
CornedBee
Nov 22nd, 2006, 04:31 AM
Is this exactly the code you have in your .java file? Can you copy & paste a bit from the source, with a little more context?
GhettoT
Nov 23rd, 2006, 08:30 PM
if(Value>0.0)
{
stack.push('Pj');
stack.push('Pi');
stack.push('Pt');
}
else
stack.push(convex.get('i'));
Try that maybe...But yes, the whole code. Or at least the part that deals with this would be help full.
penagate
Nov 23rd, 2006, 09:05 PM
GhettoT, how is that any different?
CornedBee
Nov 24th, 2006, 03:26 AM
It's invalid, for a start. You can't (or at least really, really shouldn't - not sure in Java) put single qoutes around more than one character, unless it's an escape sequence.
System_Error
Nov 24th, 2006, 03:33 PM
Hi all,
I am having problem with a simple If statement:
if(Value>0.0)
{
stack.push(Pj);
stack.push(Pi);
stack.push(Pt);
}
else
stack.push(convex.get(i));
Value is greater(double) then 0.0. After it goes "if statement", it continues to goes through "else". Event though the Value is greater than 0.0.
Thanks!
Are you sure stack.push(convex.get(i)); doesn't just have the same value as stack.push(Pj); or stack.push(Pi); or stack.push(Pt); ?
To test whether it really is going through both the if statement and else statement:
if(Value>0.0)
{
stack.push(Pj);
stack.push(Pi);
stack.push(Pt);
System.out.println("IF STATEMENT");
}
else
{
stack.push(convex.get(i));
System.out.println("ELSE STATEMENT");
}
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.