41) Can we override static method?
No, you can't override the static method because they are the part of class not object.42) Why we cannot override static method?
It is because the static method is the part of class and it is bound with class whereas instance method is bound with object and static gets memory in class area and instance gets memory in heap.43) Can we override the overloaded method?
Yes.44) Difference between method Overloading and Overriding.
Method
Overloading
|
Method
Overriding
|
1) Method overloading increases the readability of the
program.
|
Method overriding provides the specific implementation of
the method that is already provided by its super class.
|
2) method overlaoding is occurs within the class.
|
Method overriding occurs in two classes that have IS-A
relationship.
|
3) In this case, parameter must be different.
|
In this case, parameter must be same.
|
No comments:
Post a Comment