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
Which number is denoted by leading 0x or 0x in java?
What is a stack class in java ?
What does opcode mean?
Is ++ operator thread-safe in java?
How can you avoid serialization in child class if the base class is implementing the serializable interface?
Which category the java thread do fall in?
What is the abstract class?
Which software is used for java programming?
How to reverse a string in java?
Is it possible for a yielded thread to get chance for its execution again?
When should the method invokelater() be used?
Difference between character constant and string constant in java ?
How do you create a first line indent?
Why local variables are stored in stack?
What are the different types of multitasking?