As a program became larger.
It's time make some arrange on classes that exists in an application.
package, was used to group related classes togethor and provides access control.
To define a package. use the the key word `package` and following the package name.
Note that it must appear at top of a file before any statement, import and class definition.
<a href="http://ipost2host.com/viewtopic.php?f=13&t=2375#" target="_blank">
</a>
Code:
package com.Waushares;
Then, you now can define classes or interfaces (Java 1.5 or later) or one class or interface per file with filename case-sensitive.
Here is the accessor modifier that control access to class member, public, protected, private, not speficed
public - world access.
private - only the class itself
not speifced - only within the package itself
protected - within the package itself and world with sub-classes.
Only the protected access required a bit more time to understand.
All others are easy to got.
Never argue with an idiot; First he takes you down to his level and then he beats you with experience.
Bookmarks