You never need to put a class in a package . However, it is almost always a good idea. This is something that Netbeans aggressively tries to encourage you to do. For small projects, using the default package (that is, a file without a package statement) is OK.