charAt does not print 0 or 1

0

I understand that charAt takes my value in the position I say, but it turns out that in string "100110", I print the 1 as 49 and the 0 as 48 and I need the 0 and 1. I show a part of my code:

    public void evaluarPalabra() {

    System.out.print("Ingrese palabra a evaluar: ");
    String palabra = entrada.next();
    lg = new ListaGenerica();

    //Hago una lista generica con los digitos de la palabra a evaluar.
    for (int i = 0; i < palabra.length(); i++) {
        lg.insertar(lg.cantidad() + 1, palabra.charAt(i));
        lg.imprimir();
    }

I want to break the entered word and put each digit in a generic list, but only 48s and 49s are added. What's up?

"entry" is the object of the Scanner class and the print class ():

public void imprimir() {
    Nodo reco = raiz;
    while (reco != null) {
        System.out.print(reco.info);
        reco = reco.sig;
    }
    System.out.println();
}
    
asked by Deivis Cervantes Puello 18.05.2018 в 03:19
source

0 answers