aspose file tools*
The moose likes Beginning Java and the fly likes Illegal modifier for parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Illegal modifier for parameter" Watch "Illegal modifier for parameter" New topic
Author

Illegal modifier for parameter

Leroy J Brown
Ranch Hand

Joined: Dec 02, 2007
Posts: 71
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 ]
    Taariq San
    Ranch Hand

    Joined: Nov 20, 2007
    Posts: 192
    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

    Joined: Dec 02, 2007
    Posts: 71
    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

    Joined: Nov 20, 2007
    Posts: 192
    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.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Illegal modifier for parameter
     
    Similar Threads
    illegal start of an expression
    Having trouble understanding an error code i keep getting. Please help!
    Ready to give up!
    SubClass Blues!
    Help on testprogram and subclass please