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 java virtual machine?
Write code of any action class?
Can we initialize the final blank variable?
What are the different types of collections in java?
What is encapsulation in java?
Can we force the garbage collection to run?
How big is a 32 bit integer?
Where local and global variables are stored?
What is an class?
What is generic type?
How many arguments can be passed to main ()?
Are static members inherited to sub classes?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters in java programming?
How to Sort Strings which are given in List and display in ascending order without using java api.
What is finally block?