在以下程序中,command是Apdu类中的字节数组字段。问题是我的IDE (Netbeans)标记了
apdu.command = {(byte) 0x00, (byte)0xa4, (byte) 0x00, (byte) 0x00};如果出现错误,则该消息将非法启动表达式,而可以使用以下内容:
byte[] bytes = {(byte) 0x00, (byte) 0xa4, (byte) 0x00, (byte) 0x00};
apdu.command = bytes;第一批节目怎么了?
第一个节目:

第二个方案:

发布于 2016-03-14 08:06:41
您需要使用以下方法初始化数组变量:
apdu.command = new byte[] {(byte) 0x00, (byte)0xa4, (byte) 0x00, (byte) 0x00};您尝试的初始化仅在数组声明表达式中有效。
发布于 2016-03-14 08:07:05
数组语法{}只能用于初始化,而不能用于赋值。
您需要使用apdu.command =new byte[] {(byte) 0x00, (byte)0xa4, (byte) 0x00, (byte) 0x00};。
https://stackoverflow.com/questions/35982314
复制相似问题