end end end end toc toc mail

Vectors -- Introduction

Expressions
import java.util.Vector;

class Vector_0 {

  public static void main( String args[] ) {
	Vector vector = new Vector();

	System.out.println(  vector.size());
  }
}
hint
import java.util.Vector;

class Vector_1 {

  public static void main( String args[] ) {
	Vector vector = new Vector(1);
	
	vector.addElement("5");
	vector.addElement("7");
	vector.addElement("11");

	System.out.println(  vector.size());
  }
}
hint
import java.util.Vector;

class Vector_2 {

  public static void main( String args[] ) {
	Vector vector = new Vector(1);
	
	vector.insertElementAt("1", 0);
	vector.insertElementAt("3", 0);
	vector.insertElementAt("5", 0);

	System.out.println(  vector.elementAt(0));
  }
}
hint
import java.util.Vector;

class Vector_3 {

  public static void main( String args[] ) {
	Vector vector = new Vector(1);
	
	vector.insertElementAt("1", 0);
	vector.insertElementAt("7", 0);
	vector.insertElementAt("3", 2);
	vector.insertElementAt("7", 3);
	vector.insertElementAt("6", 0);

	System.out.println(  vector.lastElement());
  }
}
hint
import java.util.Vector;

class Vector_4 {

  public static void main( String args[] ) {
	Vector vector = new Vector(1);
	
	vector.insertElementAt("1", 0);
	vector.insertElementAt("7", 0);
	vector.insertElementAt("3", 0);
	vector.insertElementAt("7", 0);
	vector.insertElementAt("6", 0);
	vector.setSize(2);

	System.out.println(  vector.lastElement());
  }
}
hint
import java.util.Vector;

class Vector_5 {

  public static void main( String args[] ) {
	Vector vector = new Vector(1);
	
	vector.addElement("1");
	vector.addElement("7");
	vector.addElement("3");
	vector.addElement("7");
	vector.addElement("6");

	System.out.println(  vector.indexOf("7"));
  }
}
hint
import java.util.Vector;

class Vector_6 {

  public static void main( String args[] ) {
	Vector vector = new Vector(1);
	
	vector.insertElementAt("1", 0);
	vector.insertElementAt("1", 3);

	// Is there a problem, if you execute
	// this program?
  }
}
hint

end end end end toc toc mail


Created by unroff & hp-tools. © by csfac. All Rights Reserved (Oct/14/1999).

Last modified: 14/October/99 (16:18)