954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help on error message, illegal start an ';' expected

I am getting the following syntax messages:

illegal start of expression public void display_menu()
(with arrow pointing to the 'p')

and also

';' expected } (with arrow also pointing to the })

This is my code for the first error:

public class InsyStudent extends Student
{

public InsyStudent( String fName, String lName, String ssn )
{

int midTerm;
int finalExam;
int researchProject;
int presentationScore;


public void display_menu()
{
System.out.println( "1) INSY 3305\n2) INSY 3305\n3) INSY 4304");
System.out.println("4) INSY 4305\n5) INSY 4310\n6) INSY 4320\n" );

}

This is my code for the second error:

public String toString()
{
return String.format( "%s %s\t%s", super.toString(), selectCourse() );
}

}

What is the problem?

Maria5683
Newbie Poster
7 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

first: You're not closing your constructor, check your braces!

second: count the arguments to String.format(). Your template string takes 3 arguments, you supply only 2.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You