Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If condition statement " ';' expected syntax error " 1

Status
Not open for further replies.
Aug 1, 2003
39
US
Working on piece of code for awhile but do not see why I am getting the ';' expected, syntax error for the if statement.

Code:
package squaresdialog;

import javax.swing.JOptionPane;

public class Main {

    public static void main(String[] args) {
        String amount =
               JOptionPane.showInputDialog(null,"Enter a number from 1 to 5"); 
                             
        int number = Integer.parseInt(amount);
        
        [b] If ( number < 6 && number > 0 )[/b]                 
        
            JOptionPane.showMessageDialog(null,"Must be a number less than 6", "Message - Please note", JOptionPane.INFORMATION_MESSAGE);

} //End Main
} //End Class squaresdialog



--------------------------
Thanks
Brian

 
You should write instead of
Code:
[COLOR=red]If[/color] ( number < 6 && number > 0 )
the if statement in lowercase
Code:
[COLOR=green]if[/color] ( number < 6 && number > 0 )
 
That was it and I appreciate your help. I know Java is case sensitive but I had no idea that was as well.



--------------------------
Thanks
Brian

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top