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

What is replaceall in java?

541


Which variable is the independent variable?

529


Can we overload destructor in java?

536


How do you delete a list in java?

524


Can It is possible to synchronize the constructor of a Java Class?

588






What do you know about the garbage collector?

605


How will you add panel to a frame?

640


What is an object’s lock and which object’s have locks?

502


What are parameters in a method?

581


What is the difference between break and continue statements?

544


What do you understand by the term polymorphism?

623


what is a thread pool in java and why is it used?

525


What is the benefit of using enum to declare a constant?

652


What is the difference between JVM and JRE?

616


Explain different ways of creating a thread?

524