Results 1 to 3 of 3

Thread: Abstract, final and static keywords

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Geek_Guest
    Guest

    Abstract, final and static keywords

    Question asked by visitor sandhya

    Hi

    i am a bit confused between the abstract, final and static keywords as final cannot be overriden and static cannot be inherited i want to know whether static can be overridden and final can be inherited and whether abstract can be overridden and inherirted ?

    thanks in advance ! !!


  2. #2
    Junior Member
    Join Date
    Apr 2007
    Answers
    3

    Re: Abstract, final and static keywords

    Hi,

    Abstract class-All the methods in it are abstract means they have no implementation. We can extend the abstract class and implement the methods in it and one more thing is we need to give the implementation to all the abstract mehods otherwise the subclass also become an abstract class.

    Abstract class is one that contains atleast one abstract method with no implementation.We can't instatiate an abstract class.

    Final Class- Final itself specifies that it neither be instantiated nor be extended.

    static class-Means without instantiation we can use the methods and variables in it using the class name itself.
    Static members can accessconly static data. Nonstatic members can access both static and nonstatic data.

    Regards..


  3. #3
    Contributing Member
    Join Date
    Nov 2007
    Answers
    46

    Re: Abstract, final and static keywords

    ABSTRACT:
    - the class can be extendable but we can't instantiate that.
    - the class must be used if you declare.
    FINAL:
    - if you apply on the class, which can not be extendable.
    - if you apply on methods, those are not overridden.
    -if you apply on variables, those are not reinitialized.
    STATIC:
    - those methods and block can be invoked before creating an instantiation.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact