Results 1 to 3 of 3
  1. #1
    esolve is offline Member
    Join Date
    Mar 2015
    Posts
    56
    Rep Power
    0

    Default override/hide a final method in super class.

    Java Code:
    class Father(){
        final void func(){..} 
    }
    Java Code:
    class Son extends Father(){
        void func(){
             super.func();
        }
    }
    my question is:
    1) since func() in the class Father is final, it can't be override, is it correct in grammar for us to define the void func() in the Son class?
    2) if so, is this called hide?

    thanks!

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: override/hide a final method in super class.

    I don't understand why you are asking that question. You took the time to type in the
    code so why didn't you just type it in a file and try it out and see? They you can ask questions
    about anything you don't understand.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: override/hide a final method in super class.

    Closing this one as it's a duplicate,
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 10
    Last Post: 01-09-2012, 09:57 PM
  2. Replies: 1
    Last Post: 10-17-2011, 02:00 AM
  3. problem in set & get method of a super class
    By elenora in forum Advanced Java
    Replies: 5
    Last Post: 04-22-2011, 02:42 PM
  4. Replies: 5
    Last Post: 01-26-2011, 07:38 PM
  5. Override class method
    By Mekie in forum New To Java
    Replies: 8
    Last Post: 11-01-2010, 07:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •