what does the "com." part of a package statement mean. For example com.programs.wow;
Come and play the games.....
as far as i understand it, packages work somewhat like folders do. For example, java.util.* import all class files in the package named util, which is contained in a package named java.
in other words, com is a folder name
package names are recommended to be the reverse of the url where they may be found...
for example if sun write a whizzbang component for java and they offer it for download at http://whizzbang.java.sun.com
then they SHOULD package it like:
BUT there are no restrictions.. because after all, package merely states "this file will be found at the stated path"
so a file that has package com.sun.java.whizzbang should be found in the following path:
AND, the "com" folder MUST be on your classpath.. so if your classpath is c:\myJavawork then the FULL path of the whizzbang suite must be:
otherwise, your "import com.sun.java.whizzbang.*" statement ina java source file, WONT work..
i really really need to write a classpath tutorial..
as i've seen people mention before, you're working your way towards a book with these tutorials. Will we get discounts?
Just a small add-on, the basing off URL is to help ensure unique names. It's very likely that a number of people/sources might create a class called say, StringUtility. A unique package name like com.reinkesm.utils.StringUtility keeps it seperate from a com.cjard.tutorial.StringUtility so if I wanted, I could reference both classes within my code.
Originally posted by mikeBarr81
Will we get discounts?
bah, youth of today.. asking for discounts on a free thing
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center