| Author |
Package syntax
|
Frank Metzger
Greenhorn
Joined: Aug 04, 2011
Posts: 6
|
|
Hello,
I have seen packages declared like this: package pkg1, pkg2, pkg3; but have also seen them declared like this: package BookPack1, BookPack2, BookPack3;
Which method is commonly used? Is there a reason, why the later would be used?
|
 |
vineet dhar
Greenhorn
Joined: Aug 17, 2011
Posts: 23
|
|
Dan Storjohann wrote:Hello,
I have seen packages declared like this: package pkg1, pkg2, pkg3; but have also seen them declared like this: package BookPack1, BookPack2, BookPack3;
Which method is commonly used? Is there a reason, why the later would be used?
It is just for your understanding and code maintainability....suppose you have written a code...you know what pkg 1, 2, or 4 does...but when you give this code to someone else for reading, the way of writing for the latter part would be easy to comprehend....So always go for the conventional style of writing and use meaningful variable names...
Vineet
|
 |
Ronald Castillo
Ranch Hand
Joined: Apr 16, 2011
Posts: 47
|
|
I think he's referring to Package naming conventions.
You can pretty much name your packages any way you want (with a few exceptions).
But, as for variable names, a convention is encouraged.
http://en.wikipedia.org/wiki/Java_package#Package_naming_conventions
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
|
I would suggest that package names like pkg1 are incorrect because they give no idea what each package contains.
|
 |
 |
|
|
subject: Package syntax
|
|
|