• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem initializing with super  RSS feed

 
Chris Yates
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have class Vehicle and another file with class Car that is sub-class of Vehicle. I'am trying to initilize Car calling super but it's giving me this error which i dont understand because everything matches.
It says in the super line "Vehicle in class Vehicle cannot be applied to given types. required no arguments, found int, int, String, int, int. actual and formal arguements list differs in lenght"
Here's the code:



 
Christian Dillinger
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works here... Do you have two different classes with the name "Vehicle"?
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christian Dillinger wrote:. . . Do you have two different classes with the name "Vehicle"?
That is not possible. It is possible that there was a spelling mistake in the code which has been corrected in what was posted here however.
 
Christian Dillinger
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:
Christian Dillinger wrote:. . . Do you have two different classes with the name "Vehicle"?
That is not possible. It is possible that there was a spelling mistake in the code which has been corrected in what was posted here however.


I thought about different packages. Many users "forget" to copy that line...
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well maybe we have not been given the real code, but on using the simple name of the class Vehicle, a Vehicle class in the current (unnamed) package will take precedence over such a class in a different package.
 
Chris Yates
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Makes this line of code into a single line like this:

solved the problem. No idea why lol
 
Stephan van Hulst
Saloon Keeper
Posts: 7991
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a hiccup in your editor. They get a little bit confused every now and then. The compiler definitely should allow line breaks in constructor signatures.

Just a small heads up: manufacter is not English. The correct spelling is manufacturer.
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using a word processor? That might add a control character to that line causing errors.

… and welcome to the Ranch
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!