return type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • babs115
    New Member
    • Jun 2015
    • 18

    return type

    I have this error in my java code[invalid method declaration;ret urn type required]the code where the error is
    Code:
    public Book(String author,int ISBN,int numberOfPages,double cost,int yearOfPublication,String publishingHouse)
    {
     super(productId,productName,cost,yearOfPublication,publishingHouse);      
     this.author = author;
     this.ISBN = ISBN;
     this.numberOfPages = numberOfPages; 
    }
    Please I need help,thanks in advance.
    Last edited by Rabbit; Jul 2 '15, 04:34 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    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!

    Comment

    Working...