When I create a package for a java does it have to be compiled and distrubuted with the program or u just usethe import statement and thats the end of it.
I wish there was a button on my monitor to turn up the intellegince.
Theres a button called 'brightness' but it doesn't work
Think about this: if you didn''t distribute your package with your app and called import com.your_package.* then where would the Java interpreter find your pacage? It''s no where on the client''s machine, and as far as I know the only way to have an app on one machine and the package on another is if you are writing an applet.
So, I would assume that you have to distribute your packages along with your app. Bummer considering how easy it is for people to decode those .class files.
Packages serve to group together a collection or _related_ classes. If you don''t define a package name then all classes in that file belong to a default unnamed package, so you can''t really get away with having no packages. The import statement is just there to save time including all the classes from a package (i.e. i can say import java.io.* so i don''t have to define like: java.io.File file i can say File file). You don''t need the package directive, but when running your code you need to just call the class name (normally java packageName.className)
Why are some developers so concerned with mashing up their byte code? Do you really care if someone can open up your class, infact this is ment to be this way so that reflection classes can get method/structure information on run-time class instances! Hay I can open .exe/.com filez with debug + i know asm, does this mean that its unsafe?? NO course it don''t! You can make any code in any language unsecured by doing stupid things (like hard coding keys etc.)....