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
What are thread local variables?
What is an immutable object? How do you create one in java?
How do you declare a variable?
How do you convert an int to a double in java?
Explain about the security aspect of java?
Can we create our own wrapper class in java?
Explain different types of wrapper classes in java?
What modifiers may be used with a top-level class?
What is the public method modifier?
How do you test a method for an exception using junit?
Can we extend singleton class in java?
Explain the difference between arraylist and linkedlist in java?
What is ordered map in java?
How is garbage collection controlled?
What is lifetime variable?