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 autoboxing in java?
Write java program to reverse string without using api?
Which sorting is used in arrays sort in java?
What is a instance variable in java?
What is meant by inheritance and what are its advantages?
what do you understand by synchronization? : Java thread
What are the advantages of assembly language?
What is the collection interface?
What is the purpose of using break in each case of switch statement?
How are the elements of a gridbaglayout organized?
What is use of map in java?
How would overload a function based on return type?
why not override thread to make a runnable? : Java thread
why an outer class cannot be declared as private?
What are loops in java?