Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / munesh yadav

Frist make instances of the two classes and then call the
respective methods.

eg. Package1 has a classA with fun functionA(Arg1,Arg2)
and Package2 has a ClassB with fun functionA(Arg1,Arg2)
import package1.classA;
import package2.classB;
public Class main{
public void main(String a[]){
classA obj1=new classA();
obj1.functionA(arg1,arg2);
classB obj2=new classB();
obj2.functionA(arg1,arg2);
}
}

Is This Answer Correct ?    19 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?

1101


What are the different access modifiers available in java?

1044


Can we call the run() method instead of start()?

1043


Print Vertical traversal of a Binary Tree.

1017


What is data type modifier?

945


what state does a thread enter when it terminates its processing? : Java thread

1050


Is null in java?

1018


Explain the difference between a Thread and a Process.

1000


What are examples of modifiers?

1128


Define an abstract class with reference to java.

998


How to implement a multithreaded applet?

2673


Is it possible to define a method in java class but provide it’s implementation in the code of another language like c?

1027


What is the difference between equals() and?

1194


How do you convert bytes to character in java?

1001


How do you check whether the list is empty or not in java?

980