Kiran Kiran - 1 year ago 143
Java Question

Java : The import collides with another import statement

I have imported an Existing Java Application into my Workspace .
I see that , a class with same name is present in different packages with in the Application.

For example a class named "" is present with in


When I tried to use both of them within a class, for example as shown below

import com.tata.model.common.Status;
import com.bayer.frontlayer.dao.Status;
public class Adapter


It started giving an error in Eclipse stating

The import com.bayer.frontlayer.dao.Status collides with another import statement

Is there anyway to solve this without changing the name of the classes??

Thank you.

Answer Source

You can use them explicitly without importing them, so the included package name differentiates between the two:

 //No imports required!
public class Adapter
     private com.tata.model.common.Status x;
     private com.bayer.frontlayer.dao.Status y;