===== 5.7 Classes and Interfaces ===== Each class and interface is described by a variable-length **class_info** structure. The format of this structure is: The items of the **class_info** structure are as follows: **token** The value of the token item is the class token ([[4.3.7.2_Classes and Interfaces| Section 4.3.7.2, Classes and Interfaces]]) assigned to this class or interface. **access_flags** The value of the ****access_flags**** item is a mask of modifiers used with class and interface declarations. The ****access_flags**** modifiers are shown in the following table. Name Value Meaning Used By ACC_PUBLIC 0x0001 Is public; may be accessed from outside its package Class, interface ACC_FINAL 0x0010 Is final; no subclasses allowed. Class ACC_INTERFACE 0x0200 Is an interface Interface ACC_ABSTRACT 0x0400 Is abstract; may not be instantiated Class, interface ACC_SHAREABLE 0x0800 Is shareable; may be shared between Java Card applets. Class, interface ACC_REMOTE 0x1000 Is remote; may be accessed by Java Card RMI Class, interface The **ACC_SHAREABLE** flag indicates whether this class or interface is shareable.[3] A class is shareable if it implements (directly or indirectly) the ****javacard.framework.Shareable**** interface. An interface is shareable if it is or extends (directly or indirectly) the ****javacard.framework.Shareable**** interface. The **ACC_REMOTE** flag indicates whether this class or interface is remote. The value of this flag must be one if and only if the class or interface satisfies the requirements defined in [[2.2.6.1_Remote Classes and Remote Interfaces| Section 2.2.6.1, Remote Classes and Remote Interfaces]]. All other class access and modifier flags are defined in the same way and with the same restrictions as described in The **//Java Virtual Machine Specification//**. Since all classes and interfaces represented in an export file are public, the **ACC_PUBLIC** flag must always be set. All other flag values are reserved. Their values must be zero. **name_index** The value of the **name_index** item must be a valid index into the ****constant_pool**** table. The ****constant_pool**** entry at that index must be a **CONSTANT_Classref_info** ([[5.6.2_CONSTANT_Classref| Section 5.6.2, CONSTANT_Classref]]) structure representing a valid, fully qualified Java class or interface name. **export_supers_count** The value of the **export_supers_count** item indicates the number of entries in the supers array. **supers[]** The **supers** array contains an entry for each public superclass of this class or interface. It does not include package visible superclasses. For a class, each value in the **supers** array must be a valid index into the ****constant_pool**** table. The ****constant_pool**** entry at each value must be a **CONSTANT_Classref_info** structure ([[5.6.2_CONSTANT_Classref| Section 5.6.2, CONSTANT_Classref]]) representing a valid, fully-qualified Java class name. Entries in the **supers** array can occur in any order. For an interface, the supers array contains a single value representing a valid index into the **constant_pool** table. The **constant_pool** entry must be a **CONSTANT_Classref_info** structure ([[5.6.2_CONSTANT_Classref| Section 5.6.2, CONSTANT_Classref]]) representing the fully-qualified name of the **java.lang.Object** class. **export_interfaces_count** The value of the **export_**interfaces**_count** item indicates the number of entries in the **interfaces** array. **interfaces[]** If this **class_info** structure describes a class, the **interfaces** array contains an entry for each public interface implemented by this class. It does not include package-visible **interfaces**. It does include all public super**interfaces** in the hierarchies of public **interfaces** implemented by this class. If this **class_info** structure describes an interface, the **interfaces** array contains an entry for each public interface extended by this interface. It does not include package visible **interfaces**. It does include all public super**interfaces** in the hierarchies of public **interfaces** extended by this interface. Each value in the **interfaces** array must be a valid index into the ****constant_pool**** table. The ****constant_pool**** entry at each value must be a **CONSTANT_Classref_info** structure ([[5.6.2_CONSTANT_Classref| Section 5.6.2, CONSTANT_Classref]]) representing a valid, fully-qualified Java interface name. Entries in the **interfaces** array can occur in any order. **export_fields_count** The value of the **export_fields_count** item gives the number of entries in the fields table. **fields[]** Each value in the **fields** table is a variable-length ****field_info**** ([[5.8_Fields| Section 5.8, Fields]]) structure. The ****field_info**** contains an entry for each publicly accessible field, both class variables and instance variables, declared by this class or interface. It does not include items representing **fields** that are inherited from superclasses or superinterfaces. **export_methods_count** The value of the **export_**methods**_count** item gives the number of entries in the **methods** table. **methods[]** Each value in the **methods** table is a **method_info** ([[5.9_Methods| Section 5.9, Methods]]) structure. The **method_info** structure contains an entry for each publicly accessible class (static or constructor) method defined by this class, and each publicly accessible instance method defined by this class or its superclasses, or defined by this interface or its super-interfaces.