473,326 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

return type

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.  this.author = author;
  5.  this.ISBN = ISBN;
  6.  this.numberOfPages = numberOfPages; 
  7. }
Please I need help,thanks in advance.
Jul 2 '15 #1
1 1450
chaarmann
785 Expert 512MB
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

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

Similar topics

5
by: Murat Tasan | last post by:
so i have a situation that i know cannot be solved directly, and i've already worked around it, but i was hoping to find an explanation as to why this behavior is as it is... i have an abstract...
2
by: Nuno Barros | last post by:
Hello, I am writting a c++ code to crete a kind of a table in memory. Each table has an container of columns, which can be of any type. To do this i created a virtual class Column which has...
5
by: Fabio Fracassi | last post by:
Hi, I belive what i am trying to do is not possible, but I hope someone can change my mind. Here is some code i'd like to write: template <class type> class engine1 {}; template <class...
59
by: Michael C | last post by:
eg void DoIt() { int i = FromString("1"); double d = FromString("1.1"); } int FromString(string SomeValue) {
3
by: C++ | last post by:
According to Thinking in C++ "You cannot modify the return type of a virtual function during overriding.but there is a special case in which you can slightly modify the return type. If you¡¯re...
17
by: benben | last post by:
Given a class template Vector<>, I would like to overload operator +. But I have a hard time deciding whether the return type should be Vector<U> or Vector<V>, as in: template <typename U,...
8
by: WakeBdr | last post by:
I'm writing a class that will query a database for some data and return the result to the caller. I need to be able to return the result of the query in several different ways: list, xml,...
9
by: hufaunder | last post by:
I have a class "TestSuper" that implements the interface "TestBase". The interface has a property of type "ReturnType". The class "TestSuper" does not return "ReturnType" but a derivation...
6
by: Andrus | last post by:
I need to create method which returns my application object type as string : TypeName(typeof( List<int>)) should return "List<int>" or "System.Collections.Generic.List<int>" ...
18
by: Carl Forsman | last post by:
there are 2 ways to return a value from a function ==================== 1) passing a reference as parameter - the following will return time void Table::Get(char* FieldName, *SYSTEMTIME time) {...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.