Syntax error, insert ";" to complete BlockStatements line 7 [message #1740731] |
Wed, 17 August 2016 16:01  |
Eclipse User |
|
|
|
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;
}
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.10483 seconds