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 / manoj
// Do you want to say like this?
//import like this:
import Package1.classA
import Package2.classB
//use it in your class
class yourclass
{
classA.methodA(); // Package1 method call
classB.methodA(); // Package2 method call
}
| Is This Answer Correct ? | 27 Yes | 3 No |
Post New Answer View All Answers
What is substring 1 in java?
Is java a compiler?
What is the use of hashmap in java?
What is thread safe java?
How can we make copy of a java object?
If an object is garbage collected, can it become reachable again?
When a lot of changes are required in data, which one should be a preference to be used? String or stringbuffer?
Describe the Big-O Notation.
Explain the difference between jdk, jre, and jvm?
Can you sort a string in java?
Write a program to find maximum and minimum number in array?
How is string stored in java?
Why are parameters used in functions?
What is the use of runnable interface?
Does java isempty check for null?