In the code below I am getting a complier error that looks like this:

';' expected
}while (employee_equals(""))
^

I am not sure why I am getting this error or how to fix it.

//get employee name
            {
              System.out.println( "Enter employee name: " );                                                     
              employeeName = input.nextLine();
                  do
                  {
                    System.out.print( "Enter proper employee name: " );
                    employee = Input.nextString();
                  }while (employee_equals(""))

                     if(employee==stop)
                       {
                         System.exit();
                       }
             } // end get employee name

Please help.

Sincerely,

Recommended Answers

All 5 Replies

I noticed that when this message posted it did not display the '^' correctly it should be pointing to the end of the line instead of the bracket at the begining.

Sincerely,

I noticed that when this message posted it did not display the '^' correctly it should be pointing to the end of the line instead of the bracket at the begining.

Sincerely,

If you put that in code tags, even though it isn't code, spacing will be retained. Otherwise all spacing is removed.

In the code below I am getting a complier error that looks like this:

';' expected
}while (employee_equals(""))
^

I am not sure why I am getting this error or how to fix it.

//get employee name
            {
              System.out.println( "Enter employee name: " );                                                     
              employeeName = input.nextLine();
                  do
                  {
                    System.out.print( "Enter proper employee name: " );
                    employee = Input.nextString();
                  }while (employee_equals(""))

                     if(employee==stop)
                       {
                         System.exit();
                       }
             } // end get employee name

Please help.

Sincerely,

Java thinks that you are trying to call a function called employee_equals , which takes a String as an argument. If you are trying to compare the String employee with the empty String using the equals function, replace the underscore with a period:

while (employee.equals(""))

Thank you for the spacing hint. I tried the <while (employee.equals(""))> as you suggested both with and without a semi-colon at the end because it is a do-while loop but still no luck. Without the semi-colon I am still getting the same message and with it I get 20 errors that were not there before. What do I do?

Sincerely,

You make it

} while (employee.equals(""));

and then evaluate the additional "20 errors".

The thing about the compiler is, it makes multiple passes through a code file, and if one pass finds an error, it will finish that pass, but not even attempt to make the other passes. And "simple" syntax proofs are the first pass. So, now you only see this problem. Once this one is fixed and the syntax proof succeeds, the compiler then makes the next pass, thereby finding your additional "20 errors".

Thank you. I will work on that and see if I can figure out why I am receiveing all these errors. Java is sooo confusing to me. I have never had trouble in any class I have taken, until now.

Sincerely,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.