• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem initializing with super

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:



 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Works here... Do you have two different classes with the name "Vehicle"?
 
Marshal
Posts: 79240
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79240
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Makes this line of code into a single line like this:

solved the problem. No idea why lol
 
Saloon Keeper
Posts: 15529
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79240
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic