File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Java Package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Package" Watch "Java Package" New topic

Java Package

Lee Kian Giap
Ranch Hand

Joined: Jan 23, 2008
Posts: 213
I come to a doubt on "How to use package in Java?"
I doesn't mean the naming convention of package (such as using reverse domain name e.g.

What I wish to ask is , let say my project involve 50 java files , how do I going to group them into different package ?
Anyone know whether there is Best Practice on doing this ?
e.g. package by function , package for access control purpose ??? or any other suggestion from working experience ???

Thanks in advance ~

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32301

It really depends what you have. The distinctions you described work. If the packages are large, you'd want to divide them further by function.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Java Package
It's not a secret anymore!