📄 jcvm02lang.html
字号:
</TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35918"></A><KBD CLASS="Filename-Command">implements</KBD><A NAME="marker-47387"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-39367"></A><KBD CLASS="Filename-Command">protected</KBD><A NAME="marker-47395"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-39387"></A><KBD CLASS="Filename-Command">throw</KBD><A NAME="marker-47403"></A></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35924"></A><KBD CLASS="Filename-Command">break</KBD><A NAME="marker-47374"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35926"></A><KBD CLASS="Filename-Command">else</KBD><A NAME="marker-47380"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35928"></A><KBD CLASS="Filename-Command">import</KBD><A NAME="marker-47388"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-39369"></A><KBD CLASS="Filename-Command">public</KBD><A NAME="marker-47396"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-39389"></A><KBD CLASS="Filename-Command">throws</KBD><A NAME="marker-47404"></A></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35934"></A><KBD CLASS="Filename-Command">byte</KBD><A NAME="marker-47375"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35936"></A><KBD CLASS="Filename-Command">extends</KBD><A NAME="marker-47381"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35938"></A><KBD CLASS="Filename-Command">instanceof</KBD><A NAME="marker-47389"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-39371"></A><KBD CLASS="Filename-Command">return</KBD><A NAME="marker-47397"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-39391"></A><KBD CLASS="Filename-Command">try</KBD><A NAME="marker-47405"></A></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35944"></A><KBD CLASS="Filename-Command">case</KBD><A NAME="marker-47376"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35946"></A><KBD CLASS="Filename-Command">final</KBD><A NAME="marker-47382"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35948"></A><KBD CLASS="Filename-Command">int</KBD><A NAME="marker-47390"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-39373"></A><KBD CLASS="Filename-Command">short</KBD><A NAME="marker-47398"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-39393"></A><KBD CLASS="Filename-Command">void</KBD><A NAME="marker-47406"></A></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35954"></A><KBD CLASS="Filename-Command">catch</KBD><A NAME="marker-47377"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35956"></A><KBD CLASS="Filename-Command">finally</KBD><A NAME="marker-47383"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35958"></A><KBD CLASS="Filename-Command">interface</KBD><A NAME="marker-47391"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-39375"></A><KBD CLASS="Filename-Command">static</KBD><A NAME="marker-47399"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-39395"></A><KBD CLASS="Filename-Command">while</KBD><A NAME="marker-47407"></A></P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35964"></A><KBD CLASS="Filename-Command">class</KBD><A NAME="marker-47378"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35966"></A><KBD CLASS="Filename-Command">for</KBD><A NAME="marker-47384"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35968"></A><KBD CLASS="Filename-Command">new</KBD><A NAME="marker-47392"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-39377"></A><KBD CLASS="Filename-Command">super</KBD><A NAME="marker-47400"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35972"></A> </P></TD></TR><TR><TD SCOPE="ROW" ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35974"></A><KBD CLASS="Filename-Command">continue</KBD><A NAME="marker-47379"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35976"></A><KBD CLASS="Filename-Command">goto</KBD><A NAME="marker-47385"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35978"></A><KBD CLASS="Filename-Command">package</KBD><A NAME="marker-47393"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35980"></A><KBD CLASS="Filename-Command">switch</KBD><A NAME="marker-47401"></A></P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="TableText"><A NAME="pgfId-35982"></A> </P></TD></TR></TBODY></TABLE><BR><H4 CLASS="Head3"><A NAME="pgfId-35983"></A>2.2.2.3 <A NAME="marker-47408"></A>Types</H4><P CLASS="Paragraph"><A NAME="pgfId-35984"></A>Java programming language types <KBD CLASS="Filename-Command">boolean</KBD>, <KBD CLASS="Filename-Command">byte</KBD>, <KBD CLASS="Filename-Command">short</KBD>, and <KBD CLASS="Filename-Command">int</KBD> are supported.<A NAME="marker-47409"></A> Objects (class instances and single-dimensional arrays) are also supported. <A NAME="marker-47410"></A>Arrays can contain the supported primitive data types, objects, and other arrays.</P><P CLASS="Paragraph"><A NAME="pgfId-35985"></A>Some Java Card implementations might not support use of the <KBD CLASS="Filename-Command">int</KBD> data type. (Refer to <A HREF="JCVM02lang.html#40889" CLASS="XRef">Section 2.2.3.1, Integer Data Type</A>).</P><H4 CLASS="Head3"><A NAME="pgfId-35990"></A>2.2.2.4 <A NAME="Classes"></A>Classes<A NAME="marker-47411"></A></H4><P CLASS="Paragraph"><A NAME="pgfId-35991"></A>Most of the classes in the <KBD CLASS="Filename-Command">java.lang</KBD> package are not supported on the Java Card platform. The following classes from <KBD CLASS="Filename-Command">java.lang</KBD> are supported on the card in a limited form.</P><H5 CLASS="Head4"><A NAME="pgfId-35992"></A><A NAME="marker-47412"></A>Object</H5><P CLASS="Paragraph"><A NAME="pgfId-35993"></A>Java Card API classes descend from <KBD CLASS="Filename-Command">java.lang.Object</KBD>, just as in the Java programming language. Most of the methods of <KBD CLASS="Filename-Command">Object</KBD> are not available in the Java Card API, but the class itself exists to provide a root for the class hierarchy.</P><H5 CLASS="Head4"><A NAME="pgfId-35994"></A><A NAME="marker-47413"></A>Throwable</H5><P CLASS="Paragraph"><A NAME="pgfId-35995"></A>Class <KBD CLASS="Filename-Command">Throwable</KBD> and its subclasses are supported. Most of the methods of <KBD CLASS="Filename-Command">Throwable</KBD> are not available in the Java Card API, but the class itself exists to provide a common ancestor for all exceptions.</P><H3 CLASS="Head2"><A NAME="pgfId-35996"></A>2.2.3 Optionally Supported Items</H3><P CLASS="Paragraph"><A NAME="pgfId-35997"></A>This section describes the optional features of the Java Card platform. An optional feature is not required to be supported in a Java Card platform-compatible implementation. However, if an implementation does include support for an optional feature, it must be supported fully, and exactly as specified in this document.</P><H4 CLASS="Head3"><A NAME="pgfId-36000"></A>2.2.3.1 <A NAME="40889"></A>Integer <A NAME="marker-47414"></A>Data Type</H4><P CLASS="Paragraph"><A NAME="pgfId-36001"></A>The <KBD CLASS="Filename-Command">int</KBD> keyword and 32-bit integer data type need not be supported in a Java Card implementation. A Java Card virtual machine that does not support the <KBD CLASS="Filename-Command">int</KBD> data type will reject programs which use the <KBD CLASS="Filename-Command">int</KBD> data type or 32-bit intermediate values.</P><P CLASS="Paragraph"><A NAME="pgfId-43900"></A>The result of an arithmetic expression produced by a Java Card virtual machine must be equal to the result produced by a Java virtual machine, regardless of the input values. A Java Card virtual machine that does not support the <KBD CLASS="Filename-Command">int</KBD> data type must reject expressions that could produce a different result.</P><H4 CLASS="Head3"><A NAME="pgfId-46606"></A>2.2.3.2 <A NAME="40841"></A>Object Deletion <A NAME="marker-47415"></A>Mechanism</H4><P CLASS="Paragraph"><A NAME="pgfId-46611"></A>Java Card technology, version 2.2.2 offers an optional, object deletion mechanism. Applications designed to run on these implementations can use the facility by invoking the appropriate API. See <I CLASS="Title"></I><EM CLASS="Emphasis">Application Programming Interface, Java Card Platform, Version 2.2.2</EM><I CLASS="Title"></I>. But, the facility is best suited for updating large objects such as certificates and keys atomically. Therefore, application programmers should conserve on the allocation of objects.</P><H3 CLASS="Head2"><A NAME="pgfId-36002"></A>2.2.4 Limitations of the<A NAME="marker-47416"></A> Java Card Virtual Machine</H3><P CLASS="Paragraph"><A NAME="pgfId-36003"></A>The limitations of resource-constrained hardware prevent Java Card virtual machines from supporting the full range of functionality of certain Java platform features. The features in question are supported, but a particular virtual machine may limit the range of operation to less than that of the Java platform.</P><P CLASS="Paragraph"><A NAME="pgfId-36004"></A>To ensure a level of portability for application code, this section establishes a minimum required level for partial support of these language features.</P><P CLASS="Paragraph"><A NAME="pgfId-39102"></A>The limitations here are listed as maximums from the application programmer's perspective. Java packages that do not violate these maximum values can be converted into Java Card technology-based <KBD CLASS="Filename-Command">CAP</KBD> files ("Java Card <KBD CLASS="Filename-Command">CAP</KBD> files"), and will be portable across all Java Card implementations. From the Java Card virtual machine implementer's perspective, each maximum listed indicates a minimum level of support that will allow portability of applets. </P><H4 CLASS="Head3"><A NAME="pgfId-39103"></A>2.2.4.1 Packages</H4><H5 CLASS="Head4"><A NAME="pgfId-46449"></A><A NAME="marker-47417"></A>Package References</H5><P CLASS="Paragraph"><A NAME="pgfId-46450"></A>A package can reference at most 128 other packages.</P><H5 CLASS="Head4"><A NAME="pgfId-46902"></A><A NAME="marker-47418"></A>Package Name</H5><P CLASS="Paragraph"><A NAME="pgfId-46903"></A>The fully qualified name of a package may contain a maximum of 255 characters. The package name size is further limited if it contains one or more characters which, when represented in UTF-8 format, requires multiple bytes.</P><H4 CLASS="Head3"><A NAME="pgfId-46448"></A>2.2.4.2 Classes</H4><H5 CLASS="Head4"><A NAME="pgfId-39139"></A><A NAME="marker-47419"></A>Classes in a Package</H5><P CLASS="Paragraph"><A NAME="pgfId-38949"></A>A package can contain at most 255 classes and interfaces.</P><H5 CLASS="Head4"><A NAME="pgfId-39194"></A><A NAME="marker-47420"></A>Interfaces</H5><P CLASS="Paragraph"><A NAME="pgfId-39195"></A>A class can implement at most 15 interfaces, including interfaces implemented by superclasses.</P><P CLASS="Paragraph"><A NAME="pgfId-39435"></A>An interface can inherit from at most 14 superinterfaces.</P><H5 CLASS="Head4"><A NAME="pgfId-39129"></A><A NAME="marker-47421"></A>Static Fields</H5><P CLASS="Paragraph"><A NAME="pgfId-39126"></A>A class in an applet package can have at most 256 public or protected static non-final fields. A class in a library package can have at most 255 public or protected static non-final fields. There is no limit on the number of static final fields (constants) declared in a class.</P><H5 CLASS="Head4"><A NAME="pgfId-39135"></A><A NAME="marker-47422"></A>Static Methods</H5><P CLASS="Paragraph"><A NAME="pgfId-39127"></A>A class in an applet package can have at most 256 public or protected static methods. A class in a library package can have at most 255 public or protected static methods.</P><H4 CLASS="Head3"><A NAME="pgfId-38944"></A>2.2.4.3 <A NAME="marker-47423"></A>Objects</H4><H5 CLASS="Head4"><A NAME="pgfId-36007"></A><A NAME="marker-47424"></A>Methods</H5><P CLASS="Paragraph"><A NAME="pgfId-39113"></A>A class can implement a maximum of 128 public or protected instance methods, and a maximum of 128 instance methods with package visibility. These limits include inherited methods.</P><H5 CLASS="Head4"><A NAME="pgfId-39115"></A><A NAME="marker-47425"></A>Class Instances</H5><P CLASS="Paragraph"><A NAME="pgfId-39116"></A>Class instances can contain a maximum of 255 fields, where an int data type is counted as occupying two fields. These limits include inherited fields.</P><H5 CLASS="Head4"><A NAME="pgfId-36011"></A><A NAME="marker-47426"></A>Arrays</H5><P CLASS="Paragraph"><A NAME="pgfId-36012"></A>Arrays can hold a maximum of 32767 components.</P><H4 CLASS="Head3"><A NAME="pgfId-36013"></A>2.2.4.4 <A NAME="83511"></A>Methods<A NAME="marker-47427"></A></H4><P CLASS="Paragraph"><A NAME="pgfId-39152"></A>The maximum number of variables that can be used in a method is 255. This limit includes local variables, method parameters, and, in the case of an instance method invocation, a reference to the object on which the instance method is being invoked (meaning, <KBD CLASS="Filename-Command">this</KBD>). An <KBD CLASS="Filename-Command">int</KBD> data type is counted as occupying two local variables.</P><P CLASS="Paragraph"><A NAME="pgfId-39179"></A>A method can have at most 32767 Java Card virtual machine bytecodes. The number of Java Card technology-based bytecodes ("Java Card bytecodes") may differ from the number of Java bytecodes in the Java virtual machine implementation of that method.</P><P CLASS="Paragraph"><A NAME="pgfId-46936"></A>The maximum depth of an operand stack associated with a method is 255 16-bit cells.</P><H4 CLASS="Head3"><A NAME="pgfId-39154"></A>2.2.4.5 <A NAME="marker-47428"></A>Switch Statements</H4><P CLASS="Paragraph"><A NAME="pgfId-36016"></A>The format of the Java Card virtual machine switch instructions limits switch statements to a maximum of 65536 cases. This limit is far greater than the limit imposed by the maximum size of methods (<A HREF="JCVM02lang.html#83511" CLASS="XRef">Section 2.2.4.4, Methods</A>).</P><H4 CLASS="Head3"><A NAME="pgfId-36017"></A>2.2.4.6 <A NAME="57798"></A>Class <A NAME="marker-47429"></A>Initialization</H4><P CLASS="Paragraph"><A NAME="pgfId-36018"></A>The Java Card virtual machine contains limited support for class initialization because there is no general mechanism for executing <KBD CLASS="Filename-Command"><clinit></KBD> methods. Support for <KBD CLASS="Filename-Command"><clinit></KBD> methods is limited to the initialization of static field values with the following constraints: </P><UL><LI CLASS="Bullet1"><A NAME="pgfId-46985"></A>Static fields of applet packages may only be initialized to primitive compile-time constant values, or arrays of primitive compile-time constants. </LI><P CLASS="Linebreak"></P><LI CLASS="Bullet1"><A NAME="pgfId-46986"></A>Static fields of user libraries may only be initialized to primitive compile-time constant values. </LI><P CLASS="Linebreak"></P><LI CLASS="Bullet1"><A NAME="pgfId-47174"></A>Only static fields declared in the current class may be initialized in the <KBD CLASS="Filename-Command"><clinit></KBD> method.</LI><P CLASS="Linebreak"></P></UL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -