Results 1 to 4 of 4

Thread: If...and...then

  1. #1

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    550

    If...and...then

    Just trying to figure out something really basic but not having any luck finding it on Google.

    How do I implement an if...and...then type statement in Java?

    Thanks.
    Nick Cook
    VB6 (SP6)

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Code:
    if ((x>0) && (x<=10))
    {
        System.out.println("x is between 0 and 10");
    }
    else
    {
        System.out.println("x is less than 0 or greater than 10");
    }
    For one line statments like that, you may omit the braces.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    550
    Thanks very much, crptcblade! I knew it would be simple - but no wonder I couldn't find anything on Google...
    Nick Cook
    VB6 (SP6)

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Go to java.sun.com and then to their basic java tutorial. It teaches you all that.
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width