Yurttas/PL/OOL/CS/F/02/05/04/01/A.java

From ZCubes Wiki
Jump to navigation Jump to search
 1/**
 2 *  Copyright(C) 1998
 3 *  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4 *
 5 *  Permission to use, copy, modify, and distribute this
 6 *  software and its documentation for EDUCATIONAL purposes
 7 *  and without fee is hereby granted provided that this
 8 *  copyright notice appears in all copies.
 9 *
10 *  @date   : January 1, 1998.
11 *  @author : Salih Yurttas.
12 */
13
14
15import java.util.Vector;
16
17public class A {
18
19  protected Vector a;
20
21  public A(final int n) {
22    a = new Vector();
23    for(int i=0; i<n; i++)
24      a.addElement(new Integer(i+1));
25  }
26
27  public void add(final int i) {
28    a.addElement(new Integer(i));
29  }
30
31  public void printA() {
32    int n = a.size();
33    for(int i=0; i<n; i++)
34      System.out.println(a.elementAt(i));
35    System.out.println();
36  }
37
38}