Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Package name definition  RSS feed

 
Andre Matos
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi List,

I have a basic question regarding the package name definition. Let�s say that I have a class Hello and I want to put it into a package named hello. When I was developing java desktop applications, I used to do this:

package hello;

Now, I notice searching for a java JSP/Servlet material on the Internet some examples using this:

package org.me.hello;

or

package com.me.hello;

I would like to know the differences and why use this �org.me.hello� or �com.me.hello� is better, if it is, for JSP/Servlets?

Thanks for any help.

Andre
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The idea was to fully qualify your class names with a string that was guaranteed to be unique. Since only one entitiy can own an internet domain name, using it as your package name would insure that there is never a name collision with someone else's objects.

Not sure why they wanted to flip the order around.
 
Mike Nightsky
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
simply to have an easy way to order the package imports (dumb ascii-sort).
If it was the other way round you would have a lot of package imports beginning with * or with some curious names and the package affiliation is hard to recognize aside from this, i recommend to ask this question in java-Basic.
[ January 10, 2005: Message edited by: Mike Nightsky ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!