Home Imports and packages
Do not import individual classes in your code. For example, do
import java.util.*;, not
While individual imports are actually generally considered good style, it can sometimes break our grading scripts. (If you're curious why, our tests sometimes replace classes from the standard library with our own versions, and specific imports interfere with that replacement process).
While this is a relatively trivial problem for your TA to work around while grading,
it is annoying so we prefer if you used wildcard imports (e.g.
However, outside of 14x, you should strongly prefer using individual imports. Wildcard imports are considered unclean because they open up the possibility of encountering a certain class of nasty bugs.
The main exception to this rule is if you're importing many classes from one specific package. You don't want to clutter up your imports list, so a wildcard import is more concise and is often the lesser of two evils.
Do not include
package statements in your code. They will not compile in
our grading system.
While package statements are in fact considered very good style, they are not allowed in your homework assignment because they interfere with our grading scripts. (If you are curious why, our grading scripts run unit tests on your code, and those tests assume your code lives in the default namespace).
Some IDEs such as Eclipse will automatically insert package statements whenever you start a new project – please remove them before submitting your code.
If you do not know what a package statement is, you're fine. This is not something we directly teach in CSE 142 or 143.