You forgot to post the errors.
36 Replies - 3238 Views - Last Post: 20 September 2014 - 02:12 PM
#32
Re: Help with making a book class
Posted 20 September 2014 - 01:22 PM
My bad!
Here they are:
Multiple markers at this line
- Syntax error on token "(", ; expected
- Syntax error on token ")", ; expected
- void is an invalid type for the variable
Not sure what this means. I am comparing my code to my classmates and it looks similar, but his passes with no errors and this error is holding me back.
Not sure why..
Here they are:
Multiple markers at this line
- Syntax error on token "(", ; expected
- Syntax error on token ")", ; expected
- void is an invalid type for the variable
Not sure what this means. I am comparing my code to my classmates and it looks similar, but his passes with no errors and this error is holding me back.
Not sure why..
#33
Re: Help with making a book class
Posted 20 September 2014 - 01:29 PM
You need to post the full error details, not just paraphrase them. We need to know these error details, which include the line numbers, together with the code that the errors refer to.
#34
Re: Help with making a book class
Posted 20 September 2014 - 01:30 PM
andrewsw, on 20 September 2014 - 01:29 PM, said:
You need to post the full error details, not just paraphrase them. We need to know these error details, which include the line numbers, together with the code that the errors refer to.
Well this error pertains to the last line of my code:
public class Trilogy {
public static void main(String[] args) {
}
// variables
private Book book1;
private Book book2;
private Book book3;
private String trilogyName;
// getters and setters for books
public Book getBook1() {
return book1;
}
public void setBook1(Book book1) {
this.book1 = book1;
}
public Book getBook2() {
return book2;
}
public void setBook2(Book book2) {
this.book2 = book2;
}
public Book getBook3() {
return book3;
}
public void setBook3(Book book3) {
this.book3 = book3;
}
// getter and setter for trilogyName
public String getTrilogyName() {
return trilogyName;
}
public void setTrilogyName(String trilogyName) {
this.trilogyName = trilogyName;
}
// getter and setter for name
public String getName() {
return trilogyName;
public void setName(String trilogyName) {
this.trilogyName = trilogyName;
}
}
}
#35
Re: Help with making a book class
Posted 20 September 2014 - 01:32 PM
This
is a simple syntax error: a missing, or extra, bracket, or an extra comma, etc..
Yes, you are missing the closing bracket for your getName() method. You need to look not just on the line that the error message refers to, but some lines before it as well.
The bracket on line 56 might then be unnecessary.
Quote
- Syntax error on token "(", ; expected
is a simple syntax error: a missing, or extra, bracket, or an extra comma, etc..
Yes, you are missing the closing bracket for your getName() method. You need to look not just on the line that the error message refers to, but some lines before it as well.
The bracket on line 56 might then be unnecessary.
#36
Re: Help with making a book class
Posted 20 September 2014 - 01:34 PM
Why thank you so much. Yeah I added an extrea bracket and that completes my assignment!
THANKS FOR ALL THE HELP
THANKS FOR ALL THE HELP
This post has been edited by andrewsw: 20 September 2014 - 02:11 PM
Reason for edit:: Removed previous quote, just press REPLY
#37
Re: Help with making a book class
Posted 20 September 2014 - 02:12 PM
@OP You don't have to quote a previous reply every time, there is a large Reply button further down the page.
Anyway, glad you sorted.
Anyway, glad you sorted.

New Topic/Question
Reply



MultiQuote


|