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
Explain try and catch keywords in java?
What all methods are used to prevent thread execution ?
What does it mean that strings are immutable?
How to declare objects of a class ?
Can an arraylist be empty?
Which java collection does not allow null?
What is the differences between c++ and java? Explain
What is array in java?
What are the differences between this and super keyword?
What is the default value of local and global variables?
Why char array is favored over string for the storage of passwords?
How do you sort a string in alphabetical order in java?
Why are global variables used?
What do you understand by weak reference?
What is predicate in java?