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
Explain java code for recursive solution's base case?
What is the common usage of serialization? What exceptions occur during serialization?
can java object be locked down for exclusive use by a given thread? : Java thread
What is an object's lock and which object's have locks in java programming?
How we can execute any code even before main method?
What about anonymous inner classes in java?
Write a code to show a static variable?
What is try-with-resources in java?
What do you understand by the term string pool?
explain the concept of virtual method invocation in polymorphism in detail?
What is string value?
What is the properties class in java programming?
Can a boolean be null java?
Define nashorn in java8.
What are the advantages of java over C++?