当前工程下新建包后,把一个文件的代码全部复制到新包下,文件名和原来相同,为什么会编译错误,在不同的包,不能同名?
```java
/**
* @author 小池
* @version 1.0
*/
@SuppressWarnings({"all"})
public class SellTicket {
public static void main(String[] args) {
// SellTicket01 sellTicket01 = new SellTicket01();
// SellTicket01 sellTicket02 = new SellTicket01();
// SellTicket01 sellTicket03 = new SellTicket01();
// sellTicket01.start();
// sellTicket02.start();
// sellTicket03.start();
SellTicket02 sellTicket021 = new SellTicket02();
Thread thread = new Thread(sellTicket021);
Thread thread1 = new Thread(sellTicket021);
Thread thread2= new Thread(sellTicket021);
thread.start();
thread1.start();
thread2.start();
}
}
@SuppressWarnings({"all"})
class SellTicket02 implements Runnable {
private static int num = 100;
int x=0;
@Override
public void run() {
while (true) {
if(num==0){
break;
}
System.out.println("thread"+Thread.currentThread().getName()+"卖出一张票,剩余张数"+(--num));
x++;
try {
Thread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println(x);
}
}
```