java - duplicate class

前端 未结 5 1618
广开言路
广开言路 2020-12-17 10:43

Confused as to why I get duplicate class error for the following code?

/*
 * To change this template, choose Tools | Templates
 * and open the template in th         


        
5条回答
  •  爱一瞬间的悲伤
    2020-12-17 11:15

    This also happens if your referencing the erroring class in a separate file in the same package, with the erroring class with an unmatching package path to the file where you are referencing erroring class.

    For example file 1 some.incorrect.path.package

    class_that_is_erroring{ }

    file 2 some.correct.path.package

    class new_class{

    class_that_is_erroring myclass = null;

    }

    The package paths in both files must match each other and match the file system directory.

提交回复
热议问题