⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vectorcl.java

📁 online shopping project
💻 JAVA
字号:
import java.util.*;

class vectorcl{
  public static void main(String args[]){
   Vector v=new Vector(3,2);
   System.out.println("size:"+v.size());
   System.out.println("capacity:"+v.capacity());
   v.addElement(new Integer(1));
   v.addElement(new Integer(2));
   v.addElement(new Integer(3));
   v.addElement(new Integer(4));
   System.out.println("capacity after four additions:"+v.capacity());
  v.addElement(new Double(3.25));
  System.out.println("current capacity:"+v.capacity());
  v.addElement(new Float(7.5));
  v.addElement(new Integer(1));
  System.out.println("current capacity:"+v.capacity());
  System.out.println("Firstelement:"+(Integer)v.firstElement());
 System.out.println("Lastelement:"+(Integer)v.lastElement());
if(v.contains(new Integer(1)))
  System.out.println("contains 1");
Iterator it=v.iterator();
System.out.println("\n elements in vector:");
while(it.hasNext())
  System.out.print(it.next()+" ");
  System.out.println();
 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -