• 2022-06-19
    _________可以获取ArrayList对象x中的第一个元素。
    A: x.first()
    B: x.get(0)
    C: x.get(1)
    D: x.get()
  • B

    内容

    • 0

      _________可以获取ArrayList对象x中的元素数。 A: x.getSize() B: x.getLength(0) C: x.length(1) D: x.size()

    • 1

      下面类的索引定义或使用正确的是()。 A: class MyClass{ int x; int y; public int this[int index] { get{ if (index==0) return x; else return y; }}} B: class MyClass{ int x; int y; public int this[int index] { set{ if (index==0) x=value; else y=value; }}} C: class MyClass{ int x; int y; public int INDEX[int index] { get{ if (index==0) return x; else return y; } set{ if (index==0) x=value; else y=value; }}} D: class MyClass{ int x; int y; public int this[int index] { get{ if (index==0) return x; else return y; } set{ if (index==0) x=value; else y=value; }}}

    • 2

      在某个类中存在一个方法:void getSort(int x),以下能作为这个方法的重载的声明的是( )。 A: public get (float x) B: int getSort(int y) C: double getSort(int x,. int y) D: void get(int x, int y)

    • 3

      使用切片操作在列表对象x的开始处增加一个元素3的代码为_________。 A: x[0:0] = [3] B: x[0:0] = 3 C: x[0:1] = [3] D: x[0:1] = 3

    • 4

      已知集合M中含有3个元素;0,x2,-x,则x满足的条件是() A: x≠0 B: x≠-1 C: x≠0且x≠-1 D: x≠0且x≠1