下列标号为什么是非法的? (1)GET.DATA (2)1_NUM (3)TEST-DATA (4)RET (5)NEW ITEM

题目

下列标号为什么是非法的? (1)GET.DATA (2)1_NUM (3)TEST-DATA (4)RET (5)NEW ITEM


相似考题

3.请完成下列Java程序:实现2个下拉式菜单,一个包含exit菜单项,另一个包含item1和item2共2个菜单项。要求选择exit菜单项时,退出程序;选择item1菜单项之后,item1项变为不可选而item2可选;选择item2菜单项时,item2变为不可选而item1可选。注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。程序运行结果如下:import java.awt.*;import java.awt.event.*;public class ex18_2 extends Frame. implements ActionListener {private choiceHandler ch;private MenuItem item1;private MenuItem item2;public static void main(String[] arg) {new ex18_2 ( );}ex18_2 ( ) {setTitle("ex18_2");MenuItem item;ch = new choiceHandler();MenuBar mb = new MenuBar();Menu fm = new Menu("File");fm.addSeparator();fm.add(item = new MenuItem("Exit"));item.addActionListener(this);fm.add(item);mb.add(fm);Menu mm = new Menu("Choice");mm.add(item1 = new MenuItem("item1"));item1.addActionListener(ch);mm.add(item2 = new MenuItem("item2"));item2.addActionListener(ch);mb.add(mm);setMenuBar(mb);setSize(200,200);show();}public void actionPerformed(ActionEvent ae) {if(ae.getActionCommand().equals("Exit"))System.exit(0);elseSystem.out.println(ae.getActionCommand());}class choiceHandler implements ActionListener {public void actionPerformed(ActionEvent ae) {String strCommand = ae.getActionCommand();if(_________________) {item2.setEnabled(true);item1.setEnabled(false);} else if(______________________) {item2.setEnabled(false);item1.setEnabled(true);}}}}

参考答案和解析
正确答案: (1)因为‘.’只允许是标号的第一个字符
(2)第一个字符不能为数字
(3)不允许出现‘-’
(4)不能是保留字,如助记符
(5)不能有空格
更多“下列标号为什么是非法的? (1)GET.DATA (2)1_NUM (3)TEST-DATA (4)RET (5)NEW ITEM”相关问题
  • 第1题:

    var arr = new Array(new Array(9,0,3,4,5) , ['a' , 'b' , 'c'] , new Array(2,9,0,6));则arr[1][3]=( )

    A.c

    B.6

    C.4

    D.undefined


    正确答案:D

  • 第2题:

    print({x:’item’+str(x**2)forxin(2,4,6)})输出什么?()

    • A、[2,’item4’,4,’item16’,6,’item36’]
    • B、{2:’item4’,4:’item16’,6:’item36’}
    • C、{2,4,6}
    • D、{’item4’,’item16’,’item36’}

    正确答案:B

  • 第3题:

    下列标号()是合法的。

    • A、MAIN
    • B、NEWITEM
    • C、INUM
    • D、RET

    正确答案:A

  • 第4题:

    下列标号合法的是()。

    • A、.GETDATA
    • B、1_NUM
    • C、NEW-ITEM
    • D、RET

    正确答案:A

  • 第5题:

    若有定义 class A{int x,y; static float f(int a){…} float g(int x1,int x2){…}} 及A a1=new A( );则下列用法中非法的是( )。

    • A、g(3,2)
    • B、f(3)
    • C、a1.f(4)
    • D、a1.g(2,5)

    正确答案:C

  • 第6题:

    若主程序通过堆栈向子程序传递了3个参数,子程序返回主程序时,在子程序中清除堆栈中3个参数正确的RET指令是()。

    • A、RET 3*1
    • B、RET 3*2
    • C、RET 3*3
    • D、RET 3*4

    正确答案:D

  • 第7题:

    下列的数组定义语句,不正确的是()。

    • A、int a[]=new int[5]{1,2,3,4,5}
    • B、int[,]a=new inta[3][4]
    • C、int[][]a=new int[3][];
    • D、int[]a={1,2,3,4};

    正确答案:D

  • 第8题:

    以下的数组定义语句中,不正确的是()

    • A、 int[] a=new int[5]{1,2,3,4,5};
    • B、 int[,] a=new int[3][4];
    • C、 int[][] a=new int[3][];
    • D、 int[] a={1,2,3,4,5};

    正确答案:B

  • 第9题:

    单选题
    若有定义 class A{int x,y; static float f(int a){…} float g(int x1,int x2){…}} 及A a1=new A( );则下列用法中非法的是( )。
    A

    g(3,2)

    B

    f(3)

    C

    a1.f(4)

    D

    a1.g(2,5)


    正确答案: C
    解析: 暂无解析

  • 第10题:

    单选题
    下列数组初始化正确的是:()
    A

    int[5] a= {1,2,3,4,5};

    B

    int[2][2] a = {{1,2},{3,4}};

    C

    int[][] a = {{2,3,4,5},new int[3]};

    D

    int[][] a = new int[][5];


    正确答案: B
    解析: 暂无解析

  • 第11题:

    单选题
    以下的数组定义语句中,不正确的是()
    A

     int[] a=new int[5]{1,2,3,4,5};

    B

     int[,] a=new int[3][4];

    C

     int[][] a=new int[3][];

    D

     int[] a={1,2,3,4,5};


    正确答案: C
    解析: 暂无解析

  • 第12题:

    单选题
    下列代码的执行结果是(  )。int numbers[] = new int[6];for(int i=1;i numbers[i] =i-1;System.out.print(numbers[i]+" ");}
    A

    0 1 2 3 4 5

    B

    1 2 3 4 5 6

    C

    -1 0 1 2 3 4

    D

    0 1 2 3 4


    正确答案: D
    解析:
    上述代码循环对数组numbers中的每一个成员赋值,numbers.1enght=6,循环变量i的范围是1~5,每一个成员的值为i-1,并输出该成员值,因此结果是 0 1 2 3 4 。

  • 第13题:

    阅读以下说明和C++代码,将应填入( )处的字句写在答题纸的对栏内。 【说明】 现如今线下支付系统可以使用现金(Cash)、移动支付、银行卡( Card)(信用卡( Creditcard)和储蓄卡( Debitcard))等多种支付方式( PaymentMethod)对物品(tem)账单(Bill)进行支付。图 5-1 是某支付系统的略类图。

    #include #include (vector)#include(string)using namespace stdclass PaymentMethod tpublic: virtual void pay(int cents)=0;};//class、DebitCard和item实现略,item中getprice( )获取当前物品对象的价格class Card: public PaymentMethod { private: string name, num;public Card(string name, string num)(this->name name; this->num num; } string toString ( ) { return this->getType( )+"card[name =”+name +" ,num ="+num+"]”; )} void pay(int cents) { cout<<"Payed "<execute Transaction(cents); }Protected: virtual string getType( )=0; virtual void (1) =0;};class Creditcard(2) {public. Creditcard(stringname, stringnum) ( 3) { }Protected:string getType()( return"CREDIT":} void executeTransaction(int cents)( cout<tems;∥包含物品的 vector Public: void add(Item" item items. push back(item):} int getTotalPrice ( ) { /*计算所有 item 的总价格,代码略”/} old pay( PaymentMethod* paymentMethod) {//用指定的支付方式完成支付(1) (getTotalPrice());}}Class PaymentSystemPublic:void pay( ){ Bill" bill new Bill( ); Item"item1= new Item"1234”, 10); Item*item2= new Item(“5678", 40); Bill_>add(item1);bill>add(tem2);∥将物品添加到账单中(2) ( new CreditCard("LI SI","98765432101”);∥信用卡支付}};Intmain( ) { (6) =new PaymentSystem( ); payment->pay ( );return 0;}


    答案:
    解析:
    (1)execute Transaction(int cents)(2):public Card(3): Card(name, num)(4)paymentMethod->pay(5)bill->pay(6)PaymentSystem*payment
    【解析】

    (1)定义虚方法,在子类中实现,包含 getType( ) 用和 execute Transaction(int cents)两个(2) creditcard 继承 card,所以这里填继承,用: public Card(3) Creditcard 内有构造方法,井将方法内的参数传递给父类的私有成员,填 Card(name, num)(4)利用paymentMethod对象调用pay方法,并传入具体价格getTotalPrice,这里填 paymentMethod>pay(5)调用bill的 pay 方法,bill->pay(6)通过 Paymentsystem* payment= new Paymentsystem 进行创建对象指针

  • 第14题:

    CDS路测软件进行图铃下载测试的设置时,在“WAP自动刷新”页中的Item框中的内容是“1,2;3,1;7,1,2;5,2,3;4,2,3;”,表明要下载()个测试项目。

    • A、2
    • B、3
    • C、4
    • D、5

    正确答案:D

  • 第15题:

    下列数组初始化正确的是:()

    • A、int[5] a= {1,2,3,4,5};
    • B、int[2][2] a = {{1,2},{3,4}};
    • C、int[][] a = {{2,3,4,5},new int[3]};
    • D、int[][] a = new int[][5];

    正确答案:C

  • 第16题:

    public class Item {  private String desc;  public String getDescription() { return desc; }  public void setDescription(String d) { desc = d; } public static void modifyDesc(Item item, String desc) {  item = new Item();  item.setDescription(desc);  }  public static void main(String[] args) {  Item it = new Item();  it.setDescription(”Gobstopper”);  Item it2 = new Item();  it2.setDescription(”Fizzylifting”);  modifyDesc(it, “Scrumdiddlyumptious”);  System.out.println(it.getDescription());  System.out.println(it2.getDescription());  }  }  What is the outcome of the code? ()

    • A、 Compilation fails.
    • B、 Gobstopper      Fizzylifting
    • C、 Gobstopper     Scrumdiddlyumptious
    • D、 Scrumdiddlyumptious     Fizzylifltng
    • E、 Scrumdiddlyumptious     Scrumdiddlyumptious

    正确答案:B

  • 第17题:

    下列数组的定义不合法的是()

    • A、char c[][]=new char[2][4]
    • B、char c[][]=new char[2][]
    • C、char [][]c=new char[][3]
    • D、int []a[] = new int[5][5]

    正确答案:C

  • 第18题:

    以下()代码,能够对数组正确初始化(或者是默认初始化)。

    • A、int[ ] a;
    • B、a={1,2,3,4,5};
    • C、int[ ] a=new int[5]{1,2,3,4,5};
    • D、int [ ] a=new int[5];

    正确答案:A

  • 第19题:

    下列语句中,不能正确定义长度为4的数组a的语句是()

    • A、 int[] a=new int[]{1,2,3,4};
    • B、 int[] a= {1,2,3,4};
    • C、 int[] a=new int[4]{1,2,3};
    • D、 int[] a=new int[4]{1,2,3,4};

    正确答案:C

  • 第20题:

    var arr = new Array(new Array(9,0,3,4,5) , ['a' , 'b' , 'c'] , new Array(2,9,0,6)); 则arr[1][3]=()

    • A、c
    • B、6
    • C、4
    • D、undefined

    正确答案:D

  • 第21题:

    单选题
    下列语句中,不能正确定义长度为4的数组a的语句是()
    A

     int[] a=new int[]{1,2,3,4};

    B

     int[] a= {1,2,3,4};

    C

     int[] a=new int[4]{1,2,3};

    D

     int[] a=new int[4]{1,2,3,4};


    正确答案: A
    解析: 暂无解析

  • 第22题:

    单选题
    下列数组的定义不合法的是()
    A

    char c[][]=new char[2][4]

    B

    char c[][]=new char[2][]

    C

    char [][]c=new char[][3]

    D

    int []a[] = new int[5][5]


    正确答案: C
    解析: 暂无解析

  • 第23题:

    单选题
    下列的数组定义语句,不正确的是()。
    A

    int a[]=new int[5]{1,2,3,4,5}

    B

    int[,]a=new inta[3][4]

    C

    int[][]a=new int[3][];

    D

    int[]a={1,2,3,4};


    正确答案: D
    解析: 暂无解析