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 a boolean field?
What is difference between array and arraylist in java?
List the interfaces which extends collection interface?
What is the disadvantage of java?
What is the default value of the local variables?
What is a constructor, constructor overloading in java?
What is the difference between a choice and a list?
What is var keyword ?
Mention some features of java?
How many bytes is a char in java?
What is the difference between an argument and a parameter?
What is contract between hashcode and equal method?
What happens if we don’t override run method ?
what is the difference between a threads start() and run() methods? : Java thread
What is tostring () method?