substring y equals???

melly16_07
06 de Julio del 2006
TENGO UN PROGRMA EL CUAL NO ENTIENDO MUY BIEN PQ NOSE COMO FUNCIONA EL SUBSTRING NI EL EQUALS, UNA PREGUNTA MAS, COMO HAGO PARA Q EN VEZ DE INGRESAR LOS NOMBRES EN EL PROG. TENGA YA UN ARREGLO DE NOMBRES Y HAGA LA BUSQUEDA DESDE AHI?
import java.io.*;
import javax.swing.*;

class Nombre {

public static void main(String[] args) throws IOException{

String nom[] = new String[4];
String no,c;
int x,y=0;

InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader te=new BufferedReader(isr);


for (x=0;x<4;x++){

System.out.print("Ingresar nombre: ");
nom[x]=te.readLine();
}

System.out.print("\n");
System.out.print("Ingrese el primer caracter del nombre a buscar: ");
no = te.readLine();

for (x=0;x<4;x++){

c = nom[x].substring(0,1);//metodo para capturar un caracter y E A STRING
if (c.equals(no)) {
System.out.println(nom[x]);
y=y+1;
}
}
System.out.print("Elementos encontrados: "+y+"\n");
}
}