The Artima Developer Community
Sponsored Link

Java Answers Forum
Hello I have a Question on If statements

2 replies on 1 page. Most recent reply: Jul 5, 2002 5:39 PM by DAYO

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Leslie Jo

Posts: 22
Nickname: leeloo
Registered: Jul, 2002

Hello I have a Question on If statements Posted: Jul 5, 2002 3:26 PM
Reply to this message Reply
Advertisement
ok here is the case:
i have to ask for input from user to get a 3 digit number. however, i must start with the input as a string, then parse it into an int.
however, i cant seem to parse a string to an int if the string contains a "-". how do i do that?
also, if its a 3 digit number, then the number x, must be greater than 99, less than 1000 and less than -99, or greater than -1000. how can i put multiple conditions in an if statement??? PLEase HELP!! thanks


Leslie Jo

Posts: 22
Nickname: leeloo
Registered: Jul, 2002

Re: Hello I have a Question on If statements Posted: Jul 5, 2002 3:36 PM
Reply to this message Reply
disregard the first part..

what i want to know is, i must have a 3 digit number, positive or negative.. but i dont know how to put multiple conditions in an if statement..

DAYO

Posts: 22
Nickname: done
Registered: Jun, 2002

Re: Hello I have a Question on If statements Posted: Jul 5, 2002 5:39 PM
Reply to this message Reply
int count=0;
while(count<3)
{ //get input from user
if(input==0)
{}
else if(input>0)
{}
else if(input<0)
{}
count++;

}

Flat View: This topic has 2 replies on 1 page
Topic: free java tutorials re-open Previous Topic   Next Topic Topic: Listener Problem(Not working well)

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use