Java : The import collides with another import statement

后端 未结 3 790
面向向阳花
面向向阳花 2021-02-02 10:41

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 exampl

3条回答
  •  一个人的身影
    2021-02-02 11:08

    You can import just one of the classes and use the fully qualified name for the other one.

    e.g.

    import com.tata.model.common.Status;
    //import  com.bayer.frontlayer.dao.Status;
    
    class SomeClass{
        void someMethod(){
           new Status(); //  com.tata.model.common.Status
           new com.bayer.frontlayer.dao.Status(); //com.bayer.frontlayer.dao.Status
        }
    }
    

    Though I think it would be less confusing in your case if you just used the fully-qualified names for both classes.

提交回复
热议问题