Skip to main content



      Home
Home » Newcomers » Newcomers » Syntax error, insert ";" to complete BlockStatements line 7(Eclipse and Java for Total Beginners - Lesson 4, Syntax error, insert ";")
Syntax error, insert ";" to complete BlockStatements line 7 [message #1740731] Wed, 17 August 2016 16:01 Go to next message
Eclipse UserFriend
I'm going thru tutorial, Eclipse and Java for Total Beginners - Lesson 4

Syntax error, insert ";" to complete BlockStatements line 7

/Totalbeginner/test/org/totalbeginner/tutorial/Persontest.java
package org.totalbeginner.tutorial;

import junit.framework.TestCase;

public class Persontest extends TestCase {
public void testPerson() {
Person p1 new Person();
assertEquals("unknown name", p1.getName());
assertEquals(3, p1.getMaximunBooks());
}

public void testSetName() {
fail("Not yet implemented");
}

public void testSetMaximumBooks() {
fail("Not yet implemented");
}
}

line 7,
Person p1 new Person();
the p1 is highlighted


/Totalbeginner/src/org/totalbeginner/tutorial/Person.java
package org.totalbeginner.tutorial;

public class Person {
//fields
private String name; //name of the person
private int maximunBooks; //most books person can check out

//constructors
public Person() {
name = "unknown name";
maximunBooks = 3;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getMaximunBooks() {
return maximunBooks;
}

public void setMaximunBooks(int maximunBooks) {
this.maximunBooks = maximunBooks;
}

}
Re: Syntax error, insert ";" to complete BlockStatements line 7 [message #1740732 is a reply to message #1740731] Wed, 17 August 2016 16:29 Go to previous messageGo to next message
Eclipse UserFriend
"Person p1 new Person();" should be "Person p1 = new Person();"

This isn't a Java programming forum, though. You want a different audience like http://stackoverflow.com or https://coderanch.com/forums/f-33/java .
Re: Syntax error, insert ";" to complete BlockStatements line 7 [message #1740741 is a reply to message #1740732] Wed, 17 August 2016 21:13 Go to previous message
Eclipse UserFriend
Embarrassed
Thanks
Previous Topic:Command to clean workspace
Next Topic:Missing Swing drop down from menu
Goto Forum:
  


Current Time: Thu Jul 10 23:27:50 EDT 2025

Powered by FUDForum. Page generated in 0.10483 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top