Programación en Java/La clase Vector
import java.io.*; public class programa {
/** Creates a new instance of programa */ public static void main( String [] args ) throws IOException { int i,n,num,op,a,ndt,x,z,sw,j; int v[]; v=new int[10]; BufferedReader in= new BufferedReader (new InputStreamReader (System.in) ); System.out.println ("digite dimension de vector:"); n = Integer.parseInt (in.readLine()); for(i=1;i<=n;i++) { System.out.println("digite un numero:"); num=Integer.parseInt (in.readLine()); v[i]=num; } System.out.println("el vector almacenado:"); for(i=1;i<=n;i++) { System.out.println(v[i] + " "); } do{ System.out.println("menu principal"); System.out.println("ingresar nota"); System.out.println("buscar nota"); System.out.println("eliminar nota"); System.out.println("actualizar nota"); System.out.println("salir"); System.out.println("digite una opcion:"); op=Integer.parseInt(in.readLine()); switch(op){ case 1: System.out.println("digite cantidad de elementos a insertar:"); j = Integer.parseInt(in.readLine()); a=n+j; for (i=(n+1);i<=a;i++) { System.out.println("digite nuevo dato:"); ndt = Integer.parseInt(in.readLine()); v [i]=ndt; } for (i=1;i<=a;i++) { System.out.print(v [ i ] + " "); } break; case 2: System.out.println("digite dato a buscar:"); x=Integer.parseInt (in.readLine()); i=1; sw=0; while(i<=n && sw==0) { if(v[i]==x) { System.out.println("el dato se encontro:"); System.out.println("en la posicion:" + i); sw=1; } i=i+1; } if(sw==0) { System.out.println("el dato no existe:"); } break; case 3: System.out.println("### eliminar nota ###"); break; case 4: System.out.println("digite dato a buscar:"); x = Integer.parseInt(in.readLine()); i=1; sw=0; while(i<=n && sw==0) { if(v[i]==x) { System.out.println("el dato se encontro:" + i); sw=1; System.out.println("digite nuevo dato"); z = Integer.parseInt(in.readLine()); v[i]=z; } i=i+1; } if(sw==0) { System.out.println("el dato no existe:"); } for (i=1;i<=n;i++) { System.out.print(v [ i ] + " "); } break; case 5: System.out.println("### salir ###"); break; default: System.out.println("opcion invalida"); break; } }while(op!=5); System.out.println("fin del programa"); } }