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: Illegal Start of Expression in IF Statement

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Illegal Start of Expression in IF Statement

    Hello Everyone! am new in java programming and am having Illegal Start of Expression here if( StudentID == 0), any idea on how i can resolve this error?

    Thanks in advance.
    Chris



     
     public void SaveandNewStudents(){
            StudentID = Integer.parseInt(txtstudentID.getText());
            FirstName =txtStudentFname.getText();
            LastName =txtStudentLName.getText();
     
            Room = Integer.parseInt(txtRoom.getText());
            DateOfBirth = Integer.parseInt(txtDateOfBirth.getText());
            ZIPPostalCode =Integer.parseInt(txtpostalcode.getText()); 
     
             Company =txtcompany.getText();
             GuardianFirstname =txtguardianFname.getText();
             GuardianLastname = txtguardianLname.getText();
             GuardianE_mail = txtguardianemail.getText();
     
            WebPage =txtwebpage.getText();
            E_MailAddress =txtemail.getText(); 
            Level =
            Notes =txtArea.getText();
            Sex = 
            Attachments = 
            Street = txtstreet.getText();
            City =txtcity.getText(); 
            StateProvince =txtstateprovince.getText(); 
            CountryRegion =txtcountry.getText();
            GuardianRelationship = 
            PhysicanName = txtphysicianname.getText();
            Allergies = txtAllergies.getText();
            Medications = txtMdeications.getText();
            EmergencyContactName = txtemegencycontactname.getText();
            EmergencyContactRelationship =  
     
           [COLOR="#0000FF"] if( StudentID == 0) {[/COLOR]
            JOptionPane.showMessageDialog(rootPane, "Please enter StudentID.");
            } else{
                try{
     
                      BusinessPhone = Integer.parseInt(""+txtbusinessphone.getText());
                      HomePhone = Integer.parseInt(""+txthomephone.getText());
                        MobilePhone = Integer.parseInt(""+txtmobilephone.getText());
                        FaxNumber = Integer.parseInt(""+txtfaxnumber.getText());
                         PhysicanPhoneNumber = Integer.parseInt(""+txtphysicianphonenumber.getText());
                           EmergencyContactPhone1 =Integer.parseInt(""+txtemergencyphonenumber1.getText());
                            EmergencyContactPhone2 = Integer.parseInt(""+txtemegencyphonenumber2); 
                             //create a StudentsInfo object and pass it to StudentsDAO to save it
                           StudentsInfo Students = new StudentsInfo();
                            StudDAO.saveStudents(Students);
                }catch (Exception e){
                    System.out.print("Input is a string");
                       JOptionPane.showMessageDialog(rootPane, "Please enter Phone Number. ");
                }
     
            }      
     
     
     
        }[LIST=1][/LIST]
    Last edited by jps; September 10th, 2013 at 12:52 AM. Reason: No spaces allowed in code tag
    @nourn


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,537
    My Mood
    Grumpy
    Thanks
    0
    Thanked 166 Times in 157 Posts

    Default Re: Illegal Start of Expression in IF Statement

    Level =
    Sex =
    Attachments =
    GuardianRelationship =
    EmergencyContactRelationship =
    Is that your actual code? Plenty of code missing.
    Improving the world one idiot at a time!

  3. #3
    Member
    Join Date
    Aug 2013
    Posts
    37
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Illegal Start of Expression in IF Statement

    You should post declarations of you variables, there might be something with it, also, you can check your grammar, there is spelling mistakes in almost every word, and you can write your program in netbeans, it will show you all errors and warnings in your code.

Similar Threads

  1. Illegal start of expression.
    By finding_my_inner_geek in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 25th, 2013, 08:59 AM
  2. Illegal start of expression
    By bad_newbie in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 16th, 2013, 07:57 PM
  3. Help With illegal start of expression
    By inshal in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 9th, 2013, 12:20 PM
  4. need help with illegal start of expression
    By inshal in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 9th, 2013, 10:25 AM
  5. Help With illegal start of expression
    By RaceRed in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 7th, 2013, 08:02 PM