|
-
Nov 21st, 2006, 08:30 PM
#1
Thread Starter
Lively Member
if statement
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!
-
Nov 22nd, 2006, 05:31 AM
#2
Re: if statement
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?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 23rd, 2006, 09:30 PM
#3
Junior Member
Re: if statement
Code:
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.
-
Nov 23rd, 2006, 10:05 PM
#4
Re: if statement
GhettoT, how is that any different?
-
Nov 24th, 2006, 04:26 AM
#5
Re: if statement
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.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 24th, 2006, 04:33 PM
#6
Frenzied Member
Re: if statement
 Originally Posted by AlnavPlatinum
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:
Code:
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");
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|