class A
{
public void disp(int a,int b)
{
System.out.println("hai");
}
}
class B
{
public void disp(int a,int b,int c)
{
System.out.println("hai");
}
}
above program is overloading or overriding?
Answer Posted / pravallika
There is no relation between both the classes,so it is neither
overloading nor overriding.overloading and overriding means IS-A Relationship must be there in both the classes.
for ex:
class A
{
public void disp(int a,int b)
{
System.out.println("hai");
}
}
class B extends A
{
public void disp(int a,int b,int c)
{
System.out.println("hai");
}
}
the above program is overloading,because Is-A Relationship is available in both the classes.
Is This Answer Correct ? | 11 Yes | 5 No |
Post New Answer View All Answers
How can you write a loop indefinitely in java programming?
What checkbox method allows you to tell if a checkbox is checked?
Can you explain the cs option of java interpreter?
How does the java compiler work?
What are the parts of a method?
What is string and its types?
What’s the difference between applets and standalone program?
What is return in java?
What are "methods" and "fields"?
What is the purpose of encapsulation?
Why char array is favored over string for the storage of passwords?
Why doesn't the java library use a randomized version of quicksort?
What are the data types supported by java?
What is string length in java?
What initialize variables?