import java.io.*;
import java.util.*;

public class Palindrome {
    
    public static void main(String[] args) throws IOException {
        
        char letter;
        String reversed,NEW; 
        Stack S = new Stack();
        BufferedReader stndin=new BufferedReader(new InputStreamReader(System.in));
        
        System.out.print("Enter a word: ");
        String word=stndin.readLine();
        for(int i=0; i<word.length(); i++){
        	letter = word.charAt(i);   //this line should cut the 1st letter of the word (but im not sure with this process)
        	S.push(letter);			   //then push that letter to the stack
        }
        for(int i=0; i<word.length(); i++){
        	NEW = S.pop();				//the problem goes here with ERROR:incompatble types
        	CONCAT(reversed,NEW);		//ERROR:cannot find symbol method CONCAT(java.lang.String,java.lang.String)
        }
        if(reversed.equals(word)){
        	System.out.println("Palidrome!");
        }
        else System.out.println("Not Palidrome!");
        
    }
}

Help done...

package school;

import java.io.*;
import java.util.*;

public class Palindrome {

    public static void main(String[] args){
        //av advanced, but simpler using generics
        //av Stack<Character> S = new Stack<Character>();// define data-type of stack
        Stack S = new Stack();// default data-type of stack Object
        //av Character letterPush; // push and pop same type
        char letterPush; // push and pop same type
        //av Character letterPop;
        char letterPop;

        String reversed = "";// initialize to empty String, (not null !!)
        BufferedReader stndin = new BufferedReader(new InputStreamReader(System.in));
        System.out.print("Enter a word: ");
        String word = stndin.readLine();
        for (int i = 0; i < word.length(); i++) {
            letterPush = word.charAt(i);
            System.out.println(letterPush);// control
            S.push(letterPush);
        }
        System.out.println("-");// separator
        for (int i = 0; i < word.length(); i++) {
            //av letterPop = S.pop(); // automatic cast to char
            letterPop = (S.pop()).toString().charAt(0); // ufff!! manualy casting to char
            System.out.println(letterPop);// control
            //CONCAT(reversed, letterPop);
// Write this method !!!! --> concat String and char , result as String
            //ERROR:cannot find symbol method CONCAT(java.lang.String,java.lang.String)
            reversed = new String(reversed + letterPop);
        }
        System.out.println(word);
        System.out.println(reversed);
        if (reversed.equals(word)) {
            System.out.println("Palidrome!");
        } else {
            System.out.println("Not Palidrome!");
        }
    }
}

You can uncomment //av lines and comment appropriate current lines to befriend with generics.

Thank you so much! mwaaah

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.