Scope modifiers: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl}}: Changed count of declarations to match the introduction of 'state')
(→‎{{header|Java}}: clarify java comments with a table)
Line 216: Line 216:
//limits this member to one reference for the entire JVM
//limits this member to one reference for the entire JVM


//adding no modifier allows access to the member by classes in the same package
//adding no modifier (sometimes called "friendly") allows access to the member by classes in the same package

// Modifier | Class | Package | Subclass | World
// ------------|-------|---------|----------|-------
// public | Y | Y | Y | Y
// protected | Y | Y | Y | N
// no modifier | Y | Y | N | N
// private | Y | N | N | N


//method parameters are available inside the entire method
//method parameters are available inside the entire method