Begleitmaterial Abitur 2024

Klassendiagramm

Quellcode



    public q1palindrom()
    {
    }

    public boolean palindromPruefen(String pString)    
    {
        for(int i = 0; i<pString.length();i++)
        {
            stack.add(pString.charAt(i));

        }
        boolean ueberpruefe = true;
        int i = 0;
        while(stack.getContent() != null)
        {
 
            if (stack.getContent() == pString.charAt(i))
            {
            }
            else
            {
                ueberpruefe = false;
            }
            stack.remove();
            i++;
        }
        return ueberpruefe;
    }

}