--%>

Method over ridding in java

Q. Explain method over ridding in java. Give example.              

Ans. Method over ridding: In a class hierarchy, when a method in a subclass has the same name and type signature as a method in its subclass then the method in the subclass in said to over ride the method in the super class. When an over ridden method is called from with a subclass it will always refer to the version of tat method defined the subclass. The version of the technique defined by the super class will be unseen. When show () is invoked on the object of type B, the version of show () defined in B is utilized. This is the version of show () inside B over riddles the version declared in A. If you want to access the super class version of an over ridden method function, you can do so by using super class. For example, in the version of B, the super class version is show () is invoked within the subclass version. This permits all instance variables to be exhibited.

Class B extends A

{  int K;

B { int a, int b, int c)

{  super (a, b)

K = c;

}

}

Method over ridding occurs only when the names and the types signature of the two methods are identical. If they are not then the two methods are simply over loaded. 

   Related Questions in Programming Languages

  • Q : How much does Symbian Signed

    How much does Symbian Signed certification and testing cost? Answer: Test houses contain their own prices for Symbian Signed testing. So you can check that prices through searching over the internet.

  • Q : Explain Look-and-feel Look-and-feel :

    Look-and-feel: The visual impression and interaction style given by a user interface. This is mainly the responsibility of the window manager (that is, in collaboration with the fundamental operating system) running on a specific computer. This refers

  • Q : Storing the CSS Definitions in external

    Describe the code in order to store CSS Definitions within the external Files.

  • Q : Define the term Monitor Define the term

    Define the term Monitor: It is an object with one or more synchronized techniques.

  • Q : What is an Unchecked exception

    Unchecked exception: An exception for which it is not needed to give a local try statement or to propagate through a throws clause stated in the method header. An exception which is not handled will cause program annihilation when it is thrown.

  • Q : Basic programming help In C Language 1.

    1. In what ways are the initialization, repetition test, and update steps alike for a sentinel-controlled loop and an endfile-controlled loop? How are they different? 2. Rewrite the program segment that follows using a for loop: count = 0;

  • Q : What is signal What is meant by the

    What is meant by the signal?

  • Q : Explain Package declaration Package

    Package declaration: It is a declaration employed to name a package. This should be the first item in the source file, preceding any import statements. For example,     pa

  • Q : Explain Program counter Program counter

    Program counter: A program counter is an integral portion of a computer's Central Processing Unit. It includes a reference to the memory address of the subsequent instruction to be fetched, ready to be executed throughout the next fetch-execute cycle.

  • Q : Define the term Peripheral devices

    Define the term Peripheral devices: It is the devices attached to a computer, like disk drives, printers, mice, and so forth.