Sunday, October 10, 2021

Java Package Names and Naming Convention:

 Java Package Names and Naming Convention:

  • If you're just doing personal projects where nobody else will use the code, then you can make any name .
  • Don't make up something that starts with com. or net. or other top-level domain though, because that would imply that you own the domain name (ie. using com.john as your package name just because your name happens to be John is not a good idea).
  • The domain-name-backwards convention is there to prevent name collisions. Two different companies with the same product name will have different namespaces so everything works fine.

Ref:

  • https://stackoverflow.com/a/292175
  • https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html
  • https://stackoverflow.com/a/6247924

No comments:

Post a Comment