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 are three ways in which a thread can enter the waiting state? : Java thread
What is static keyword in java?
Why is stringbuffer called mutable?
Why do we need hashmap in java?
What does method mean?
What about member inner classes?
How do I get 64 bit java?
What is a ternary operator in java?
What does super keyword do?
What modifiers may be used with an inner class that is a member of an outer class in java programming?
who can i handle multiple client in RMI
how does the run() method in runnable work? : Java thread
Explain purpose of sleep() method in java?
What is polymorphism and what are the types of it?
What class allows you to read objects directly from a stream?