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 hash code collision?
When a byte datatype is used?
What is the difference between reader/writer and inputstream/output stream?
Can you instantiate the math class in Java?
Can you extend singleton class?
What is formatted output?
What is scope & storage allocation of global and extern variables? Explain with an example
How we can generate random numbers in java?
What java ide should I use?
What is linked hashset and its features?
Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?
explain different ways of using thread? : Java thread
What is a instance variable?
I want to store more than 10 objects in a remote server? Which methodology will follow?
What is diamond operator in java?