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
Difference between arraylist and hashset in java?
What are scriptlets?
How does enum work in java?
Explain thread life cycle in java?
What is Gang of four design patterns
Explain Basics of OOP Language in java
What is number data type?
What is oop in java?
Can we override the static method?
Can we use switch statement with strings?
Difference between stack and queue?
How do you compare two strings lexicographically?
why using interface interface ?
Do you know why doesn't the java library use a randomized version of quicksort?
Which class is the superclass of all classes?