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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Restaurantapp problem

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
when i try to run my code i get the following error "Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - constructor RestaurantController in class controllers.RestaurantController cannot be applied to given types;
 required: repositories.Repository
 found: no arguments
 reason: actual and formal argument lists differ in length
at restaurantapp.RestaurantApp.run(RestaurantApp.java:22)
at restaurantapp.RestaurantApp.main(RestaurantApp.java:34)
Java Result: 1"

my restaurant app code is as follows and the error codes are on lines 19 and 29

 
Marshal
Posts: 76408
365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please read this FAQ. Please go back to the code where your IDE (??NetBeans??) will have a red mark against the code with the problem and it will tell you what the problem is.
That method probably would be better as an instance method. What does the run() method in the other class take as its parameters?
 
Saloon Keeper
Posts: 9556
79
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Also, on line 29, run() is a static method being called in a non-static way.
 
Marshal
Posts: 27367
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
There's a very very long thread discussing this particular problem already in progress. So I'm going to lock this thread and let people post to the other one.
 
I guess everyone has an angle. Fine, what do you want? Just know that you cannot have this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic