rows function insert a character

0

I'm trying to insert a last character in the first word when I enter a word of dimension 1 in the row or a "y" or "a" error and it does not do anything in my attachment method

public void cambiarUltimo(char pCar) {
        Nodo p, q;
        q = new Nodo(pCar);
        p = cab.RetornaLiga();

        while (p != null && p.GetCaracter() != ' ') {
            if (p.RetornaLiga().GetCaracter() == ' ') {
                p.AsignaLiga(q);
                q.AsignaLiga(p.RetornaLiga());
            }
        }

    }

I do not get the wrong thing is that it does not do anything to me as if it stayed in the method and did not come out public class Node {

private char car;
private Nodo liga;

public Nodo(char pCar) {
    car = pCar;
    liga = null;
}

public char GetCaracter() {
    return car;
}

public void AsignaLiga(Nodo pLiga) {
    liga = pLiga;
}

public Nodo RetornaLiga() {
    return liga;
}

}

    
asked by Rigoberto Oviedo Bolaños 24.11.2017 в 00:30
source

0 answers