Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: if statement syntax question

  1. #1
    Member
    Join Date
    Jan 2013
    Location
    Central Texas
    Posts
    39
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default if statement syntax question

    I am in a computer science academic event and in the practice tests, they give a code fragment and ask what the output will be. I know that the if statement can be notated like:
     if (someBoolean){
    someEvent}

    But the test sometimes write the if statement like:
     if (something; somethingElse; somethingElseElse;)
    I need to know how to understand the second example. What does it mean and what kind of things go before each semicolon?


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: if statement syntax question

    Quote Originally Posted by lanmonster View Post
    But the test sometimes write the if statement like:
     if (something; somethingElse; somethingElseElse;)
    I need to know how to understand the second example. What does it mean and what kind of things go before each semicolon?
    That is not valid Java code.

  3. #3
    Member
    Join Date
    Jan 2013
    Location
    Central Texas
    Posts
    39
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: if statement syntax question

    *derp* got mixed up. They do for statements like that, which is probably the right way to do it. I have not learned the for statement yet. My bad

Similar Threads

  1. Question about IF Statement
    By Brocco767 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 3rd, 2012, 03:21 PM
  2. Question about else statement
    By jean28 in forum Java Theory & Questions
    Replies: 1
    Last Post: September 23rd, 2012, 11:52 PM
  3. MySQL Syntax error in Java prepared statement
    By kc120us in forum JDBC & Databases
    Replies: 4
    Last Post: March 22nd, 2012, 11:31 AM
  4. Lazy Thursday Question: Weird Syntax You've Seen?
    By KevinWorkman in forum The Cafe
    Replies: 14
    Last Post: May 11th, 2011, 04:00 AM
  5. syntax question
    By surfbumb in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 9th, 2011, 04:01 PM