Java Reference
In-Depth Information
To do this, you might define a java4cobol package. Simply include the package
statement as the first uncommented line in your Java source file:
package java4cobol;
public class ErrorMsg {
public String msgText;
public int msgSize;
...
// Some logic
...
}
Now the ErrorMsg class is part of the java4cobol package. The fully qualified
name (FQN) of this class now becomes java4cobol.ErrorMsg .
Packages can have many parts to their names. For example, you could define a
java4cobol.message package, and place all of your message-related classes into this
package:
package java4cobol.message;
public class ErrorMsg {
public String msgText;
public int msgSize;
...
// Some logic
...
}
In this case, the complete name of your ErrorMsg class would be
java4cobol.message.ErrorMsg . Notice that java4cobol and java4cobol.message are
different packages. Also, package names should be all lowercase to ensure they will
work properly on all operating systems.
I NSIDE A P ACKAGE
Since all the classes in a package are related, it follows that they can take advantage
of each other. For one, the default access control definition for classes, methods,
and variables is package. This means that any one of these items that does not have
an explicit access control qualifier is visible to all classes in the package.
Search WWH ::




Custom Search