Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

17. Package, Jars and Deployment: Releas... > Preventing package name conflicts

Preventing package name conflicts

Putting your class in a package reduces the chances of naming conflicts with other classes, but what’s to stop two programmers from coming up with identical package names? In other words, what’s to stop two programmers, each with a class named Account, from putting the class in a package named shopping.customers? Both classes, in that case, would still have the same name:

shopping.customers.Account

Sun strongly suggests a package naming convention that greatly reduces that risk—prepend every class with your reverse domain name. Remember, domain names are guaranteed to be unique. Two different guys can be named Bartholomew Simpson, but two different domains cannot be named doh.com.

image with no caption

To put your class in a package:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint