public void keyPressed(KeyEvent e) {
    if(e.getKeyCode()==KeyEvent.VK_ENTER){
        input.setEditable(false);
        String quote=input.getText();
        input.setText("");
        addtext("You:\t"+quote);
        quote=quote.trim();
        while(
                quote.charAt(quote.length()-1)=="!" ||
                quote.charAt(quote.length()-1)=="?" ||
                quote.charAt(quote.length()-1)=="."
                ){
            quote=quote.substring(0,quote.length()-1);
        }
        quote=quote.trim();
}
it's giving me incomparable type on quote.charAt and I need to check the last character of the string if he is a punctuation
 
     
    