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


Please Help Members By Posting Answers For Below Questions

Differentiate between vector and array list.

630


placement papaers of spring computing technology

1020


give an example for encapsulation?

578


What does %4d mean in java?

839


do I need to use synchronized on setvalue(int)? : Java thread

549






What two classes are used to read data only?

634


What is stream api in java8?

533


Can you pass functions in java?

568


When do we need to use internal iteration? When do we need to use external iteration?

603


Can we override final method?

564


Can java list be null?

545


Can we override private method in java?

611


What methods are used to get and set the text label displayed by a button object?

550


define polymorphism in java

628


What is volatile keyword in java

642