Apex doesn't have the notion of Java-like packages & dependencies. Most numbers of your custom classes sit in one big namespace which sometimes leads to very long class names. For more info, you might want to check out the Disadvantages of the Force.com platform
Having said that you can make something that's called "package" in the documentation. But think about it as a plugin to your Force.com solution as a whole. You could create a package that contains only some code libraries but it's much more common to build ones that come with their own objects, visualforce pages, reports, etc. Essentially all you see on http://appexchange.com/ are such packages... This is probably a terrible analogy but I'd compare them to WAR files, not JARs.
The package can be managed (meaning the party that developed it controls it, you can't see their source code but you can use methods exposed with global the keyword for example). Unmanaged packages exist too - you're free to modify them as you see fit, delete things you don't need. Chatter Unfollow Rules is an example of an unmanaged package. Another one (lets you install as well as browse code before diving deep into the installation) could be http://code.google.com/p/apex-lang/
To make stuff more complicated you can make private packages too ;) You could then deploy it into your different salesforce org without publishing on AppExchange.
Learn about Salesforce by signing up for this professional Salesforce course online!