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 difference between future and callable interface in java?
Can we extend immutable class?
Why volatile is used in java?
What is the difference between Array and Hash Table?
Why is a constant variable important?
How do you use compareto method?
Explain the importance of throws keyword in java?
What are measurable parameters?
Explain JMS in detail.
What is protected access modifier?
Implementations of set interface?
What is off heap memory?
Can we have multiple catch block for a try block?
what do you mean by stream pipelining in java 8? Explain
What are the legal operands of the instanceof operator?