Surprises with Java packages
Packages in Java is a quite simple and straightforward concept of the language. It’s there from the beginning and it’s commonly used by every Java programmer. In a few words, these are the rules you have to follow to create a class inside a package (spoiler: which are not completely true, as we’ll see later):
Package statement must be the first one specified in a java class file A package namespace must match the physical path of the file, i.e a class defined with a package a.b.c must be placed in a path a/b/c/ Easy right? Let’s check…