perfect_tranquility
asked on
A Package spread over multiple files??
1).Can a JAVA package be spread over multiple files?
2).If yes,how do i name those files which have classes that do not have the main() in them?
3).How about naming those files?
4).How should I use the jar utility to make an archive out of all those files?
This will be of great help, experts.
2).If yes,how do i name those files which have classes that do not have the main() in them?
3).How about naming those files?
4).How should I use the jar utility to make an archive out of all those files?
This will be of great help, experts.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> 2. You must name each file containing a public class by the class name + ".java" extension.
> You need to use the import statement in the class containing main, then just use the classes.
This is generally true. However, if you're program is not part of a package, and the rest of the classes you've written for it are in the same directory, then you do not have to import the other classes, as they will already be part of the classpath when you run your program.
> You need to use the import statement in the class containing main, then just use the classes.
This is generally true. However, if you're program is not part of a package, and the rest of the classes you've written for it are in the same directory, then you do not have to import the other classes, as they will already be part of the classpath when you run your program.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
And one another thing on Netbeans IDE that I suggested on your previous questions has a utility to make a jar file for
you so that you wont have to worry about it.
you so that you wont have to worry about it.
ASKER
I am aware that there can only be one public class per file.However,why would I want to have multiple public classes when i would need just one main() function?