By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,105 Members | 2,569 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,105 IT Pros & Developers. It's quick & easy.

return type

P: 18
I have this error in my java code[invalid method declaration;return type required]the code where the error is
Expand|Select|Wrap|Line Numbers
  1. public Book(String author,int ISBN,int numberOfPages,double cost,int yearOfPublication,String publishingHouse)
  2. {
  3.  super(productId,productName,cost,yearOfPublication,publishingHouse);      
  4. = author;
  5.  this.ISBN = ISBN;
  6.  this.numberOfPages = numberOfPages; 
  7. }
Please I need help,thanks in advance.
Jul 2 '15 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 785
You are calling super with productId, productName but I cannot see any declaration for them.
Is "Book" really a constructor, I mean is your class called Book? If not then of course it needs a return type (void or whatever) like any other method.

So please provide whole code, and also the exact error message, to make a deeper analysis for us possible.

By the way, you should name "ISBN" to "isbn" (because known acronym) or "iSBN", because according to Java coding standard ony classes and constants should start with capital letters!
Jul 6 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.