Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 20:01 Go to next message
Terry Huckaba is currently offline Terry HuckabaFriend
Messages: 2
Registered: August 2016
Junior Member
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 20:29 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3503
Registered: July 2009
Senior Member

"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 .


Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Syntax error, insert ";" to complete BlockStatements line 7 [message #1740741 is a reply to message #1740732] Thu, 18 August 2016 01:13 Go to previous message
Terry Huckaba is currently offline Terry HuckabaFriend
Messages: 2
Registered: August 2016
Junior Member
Embarrassed
Thanks
Previous Topic:Command to clean workspace
Next Topic:Missing Swing drop down from menu
Goto Forum:
  


Current Time: Sat Sep 21 18:15:31 GMT 2019

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

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

Back to the top