Is it possible to do method overloading and overriding at a
time

Answer Posted / sathishkumar.m

class A
{
int c;
void add()
{
System.out.println("hai");
}
void add(int b)
{
c=b;
System.out.println("value of b:"+c);
}
}
class B
{
int e;
void add(int d)
{
System.out.println("value of d:"+e);
}
}
class Demo
{
public static void main(String aa[])
{
A o1=new B();
o1.add();
}
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is a variable stored in memory?

523


In java how do we copy objects?

548


What is the difference between preemptive scheduling and time slicing?

584


What java ide should I use?

565


What is abstraction in java?

613






What are mutable classes?

521


What are different ways of object creation in java ?

569


What is a variable analysis?

634


How to set the permissions to a file in java?

535


What is functional interface in java?

511


What are the restrictions that are applied to the java static methods?

522


What is the difference between array and array list in java?

603


What is the meaning of I ++ in java?

605


a thread is runnable, how does that work? : Java thread

507


What data type is true or false?

571