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
What is the advantage of preparedstatement over statement?
What defines function?
Can we serialize singleton class?
Is there a way to increase the size of an array after its declaration?
What are implicit objects in java?
Can an interface be defined inside a class?
How do you achieve polymorphism in java?
What is the generic function?
What is the difference between yielding and sleeping in java programming?
Does collectionutils isempty check for null?
What is the independent variable in an experiment?
List the different types of classloaders in java.
What is the difference between private & public & friendly classes?
What is the benefit of inner classes in java?
What is a memory leak in java?