首页 > 学院 > 开发设计 > 正文

Java核心代码例程之:VectorDemo.java

2019-11-18 15:16:36
字体:
来源:转载
供稿:网友

import java.util.*;


/**
 * Demonstrates how to use a Vector (essentially a growable array).
 ***/
public class VectorDemo
{
    public static void main(String args[]) throws Exception
    {
        Vector v = new Vector();
        
        v.addElement("Mary");
        v.addElement("John");
        v.addElement("David");
        v.addElement("Pam");
        v.addElement("Joe");
        
        for (int i=0; i < v.size(); i++)
            System.out.PRintln("Hello " + (String)v.elementAt(i));
    }
}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表