Package1 and Package2 both have a method name lets say
"methodA" with different implementation. When I import both
the packages in a java class how can I use both the methods?
Answer Posted / shiv
//import like this:
import Package1.class
import Package2.class
//use it in your class
class yourclass
{
class.methodA(); // Package1 method call
class.methodA(); // Package2 method call
}
Is This Answer Correct ? | 6 Yes | 19 No |
Post New Answer View All Answers
Differentiate between vector and array list.
placement papaers of spring computing technology
give an example for encapsulation?
What does %4d mean in java?
do I need to use synchronized on setvalue(int)? : Java thread
What two classes are used to read data only?
What is stream api in java8?
Can you pass functions in java?
When do we need to use internal iteration? When do we need to use external iteration?
Can we override final method?
Can java list be null?
Can we override private method in java?
What methods are used to get and set the text label displayed by a button object?
define polymorphism in java
What is volatile keyword in java