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 do you know about the garbage collector in java?
If an application has multiple classes in it, is it okay to have a main method in more than one class?
What are the differences between throw and throws?
How finally used under exception handling?
How do you implement singleton class?
You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain
Why arraylist is not synchronized in java example?
What is meant by data hiding in java?
Is integer passed by reference in java?
I don’t want my class to be inherited by any other class. What should I do?
Enlist diffrent types of inheritance supported by java?
What is the different between get and post?
What are different types of constants?
Can you override static methods?
Explain the selection sort algorithm and state its time complexity?