[说明]
java.util库中提供了Vector模板类,可作为动态数组使用,并可容纳任意数据类型。
该类的部分方法说明如下所示:
方法名 含义
add(k) 向vector对象的尾部添加一个元素k
removeElementAt(i) 删除序号为i的元素(vector元素序号从0开始)
isEmpty( ) 判断vector对象是否含有元素
size( ) 返回vector对象中所包含的元素个数
[Java代码]
Import (1) ;
public class JavaMain
static private final int (2) =6;
public static void main(String[]args)
Vector theVector=new Vector< (3) >( );
//初始化theVector,将theVector的元素设置为0至5
for(int cEachItem=0; cEachItem<ARRAY_SIZE; cEachItem++)
theVector. add( (4) );
showVector(theVector); //依次输出theVector巾的元素
theVector. removeElementAt(3);
showVector(theVector);

public static void showVector(Vector theVector)
if(theVector. isEmpty( ))
System.out.printin("theVector is empty.");
return;

for(int loop=0; loop<theVector.size( ); loop++)
System.out.print(theVector.get(loop));
System.out.print(",");

System.out.printin( );


该程序运行后的输出结果为:
0, 1, 2, 3, 4, 5
(5)

题库:初级程序员 类型:填空题 时间:2017-07-03 11:59:15 免费下载:《填空集》Word试卷

[说明]
java.util库中提供了Vector模板类,可作为动态数组使用,并可容纳任意数据类型。
该类的部分方法说明如下所示:
方法名 含义
add(k) 向vector对象的尾部添加一个元素k
removeElementAt(i) 删除序号为i的元素(vector元素序号从0开始)
isEmpty( ) 判断vector对象是否含有元素
size( ) 返回vector对象中所包含的元素个数
[Java代码]
Import (1) ;
public class JavaMain
static private final int (2) =6;
public static void main(String[]args)
Vector theVector=new Vector< (3) >( );
//初始化theVector,将theVector的元素设置为0至5
for(int cEachItem=0; cEachItem<ARRAY_SIZE; cEachItem++)
theVector. add( (4) );
showVector(theVector); //依次输出theVector巾的元素
theVector. removeElementAt(3);
showVector(theVector);

public static void showVector(Vector theVector)
if(theVector. isEmpty( ))
System.out.printin("theVector is empty.");
return;

for(int loop=0; loop<theVector.size( ); loop++)
System.out.print(theVector.get(loop));
System.out.print(",");

System.out.printin( );


该程序运行后的输出结果为:
0, 1, 2, 3, 4, 5
(5)

[说明]  java.util库中提供了Vector模板类,可作为动态数组使用,并可容纳任意数据类型。  该类的部分方法说明如下所示:  方法名  含义  ad

本题关键词:行政许可类型,动态数据,可疑类贷款,形态学类型,建筑使用年限类型,行政许可分类,行政许可种类,地貌形态类型,三类使用年限,一类使用年限;

微信扫码获取答案解析
下载APP查看答案解析