• 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

Illegal modifier for parameter

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So,
I'm working with a Java book and I'm playing around trying to understand some basic java concepts and I write some do nothing code to teach myself about overriding methods and I'm getting an error I don't understand at all.

File 1

File 2


Now, I was planning on implementing the compoundIterate method on line marked twelve in the Account class and then overriding it in SavingsAccount method on line marked 8, so I can play around and learn but I'm already getting errors and not sure what they're about. I use Eclipse IDE. All errors mentioned hereafter are in class Savings account.

@Line 8: "Illegal modifier for parameter compoundIterate; only final is permitted"
  • If I replace "public" with "final" the error goes away. Why does it want me to make this method final?

  • @Line 8: under the comma between years and monthlyInvest parameters "syntax error on token "," ; expected"

    @Line 8: under the closing parenthesis for the method signature "syntax error on token ")" ; expected"
  • replacing either of these "tokens" with a semicolon makes the error go away which doesn't make ANY sense to me at all

  • @Line 11: "Void methods cannot return a value"

  • the method signature clearly has a double return type. Why in the world does Eclipse think this method has a void return type?


  • I'm guessing I'm doing something basic wrong and Eclipse is giving me a bunch of errors that would go away if i changed it. Debugging features can tell you when something is wrong but often give misleading errors because they don't know what you're trying to do - but... I don't know what the deal is. A hint please?
    [ June 21, 2008: Message edited by: Tristan Rouse ]
     
    Ranch Hand
    Posts: 192
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    compoundIterate is seen as a parameter, in fact it's a method.
    You're missing the right curly bracket for your constructor SavingsAccount.

    Your file compiles after that.
    [ June 21, 2008: Message edited by: Taariq San ]
     
    Leroy J Brown
    Ranch Hand
    Posts: 71
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The super constructor was auto-generated by eclipse at my behest and I must have accidentally deleted the right curly brace. Thanks!
     
    Taariq San
    Ranch Hand
    Posts: 192
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Tristan Rouse:
    The super constructor was auto-generated by eclipse at my behest and I must have accidentally deleted the right curly brace. Thanks!



    You're welcome.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic