Extended CAP Accessibility Example
To understand the extended CAP file accessibility, let’s consider a scenario as shown in the following figure:
Figure 8-1 Extended CAP Accessibiliy Example

The following table describes the package level access under different access conditions (1, 2, and 3):
Table 8-1 Package Level Access
| Accessibility | package1 | package2 | package3 | package4 | package5 | 
|---|---|---|---|---|---|
| 
                               
  | 
                           N/A | 
                               Yes (1) and (2)  | 
                           
                               Yes (1)  | 
                           
                               Yes (1)  | 
                           
                               Yes (1), (2), and (3)  | 
                        
| 
                               
  | 
                           
                               Yes (1) and (2)  | 
                           N/A | 
                               Yes (1)  | 
                           
                               Yes (1)  | 
                           
                               Yes (1), (2), and (3)  | 
                        
| 
                               
  | 
                           
                               Yes (1) and (2)  | 
                           
                               Yes (1) and (2)  | 
                           N/A | 
                               Yes (1)  | 
                           
                               Yes (1), (2), and (3)  | 
                        
| 
                               
  | 
                           
                               Yes (1) and (2)  | 
                           
                               Yes (1) and (2)  | 
                           
                               Yes (1)  | 
                           N/A | 
                               Yes (1), (2), and (3)  | 
                        
| 
                               
  | 
                           
                               Yes (1) and (2)  | 
                           
                               No (1)  | 
                           
                               No (1) and (3)  | 
                           
                               Yes (1) and (3)  | 
                           N/A | 
The following are the access conditions (1, 2, and 3) that are listed in the table:
-  Exported packages in an extended CAP file - Packages in an extended CAP file can be marked as 
publicorprivate. Only thepublicpackages are accessible from packages in another CAP file. However, all packages are accessible within the same CAP file. - 
                     Java access rules - Code access conforms to Java accessibility rules
                    (
private,public,package,protected, and so on). For example, inside theClass1orClass2methods, aClass3()or aClass4()constructor can be called (only if the constructors arepublic) or other public methods fromClass3andClass4, even ifClass3andClass4are Java Card applets. - Java Card access rules for package containing an Applet - A public package containing a class extending the 
javacard.framework.Appletclass does not export all itspublicclasses and interfaces. Only the interfaces extending thejavacard.framework.Shareableinterface or the classes implementing it are exported and visible from other packages. For example, code frompackage5can access only theClass5inpackage4and cannot access content ofpackage3because nothing is exported.