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 java algorithm?
What is the symbol for line break?
Is null keyword in java?
What is the name of the java compiler?
how do I create a runnable with inheritance? : Java thread
What is jit compiler in java?
Can you use abstract and final both with a method?
How do you detect memory leaks?
How we create object in copy constructor?
What is meant by data hiding/encapsulation?
What are the elements of java?
How many types of string data types are there?
When we should use serialization?
Why we override equals() method?
List some java keywords sun like c, c + + keywords?