a.java has import java.io.*; I dragged all the java to link to the project, but some ended up with red icon, while a.java with yellow. Those with red don’t have imports, and act like there are no imports, but that’s why I put a.java there. Why doesn’t it work?
Share
Just because
A.javahasimport java.io.*;it doesn’t mean thatB.javahas access tojava.io.*;.B.javawill have to import what it wants to use explicitly, even if they are in the same package.This is specified in §6.3 and §7.5 of the JLS.
From section 6.3: