Difference between overloading and Overriding. <Giving a
confusing example to test the concept.>
(also asked in PA Consultancy Group,iflex,Value
chain,IBM,CTS,Accenture, Tarang>
Answer Posted / kabita
overriding is only possible in case of inheritance,bt
overloading is possible incase of both inheritance & same
class.
class A
{
public int add();
public float sub();
public float multi(float a,float b){}
public double div(double d,double e){}
}
class B extends A
{
public int add(int a,int b){}//must be same as declared in
super class
public float sub(float a,float b){}//must be same name same
returntype same as declared
public float multi(float a,float b,float c){}
}
| Is This Answer Correct ? | 12 Yes | 9 No |
Post New Answer View All Answers
What is anti pattern in programming?
Explain about features of local inner class?
What is the internal implementation of set in java?
Is null a string or object in java?
What will happen to the exception object after exception handling?
What is the difference between the paint() and repaint() methods in java programming?
What about main() method in java ?
What methods are used to get and set the text label displayed by a button object?
Can we pass null as argument in java?
What is not object oriented programming?
What happens when heap memory is full?
What is tostring () method?
What is garbage collector?
How do you sort an array in java?
Tell me about your ability to work under pressure