Divinty2

equals не работает

Jul 9th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. public class Main {
  2.     public static void main(String[] args){
  3.         //String text = "Madam, I'm Adam!";
  4.         String text = "Hello, World!";
  5.         if (text==null){
  6.             System.out.println("empty");
  7.             return;
  8.             }
  9.         else {
  10.             StringBuilder s = new StringBuilder((text.toLowerCase()).replaceAll("[^A-Za-z1-9]+", ""));
  11.         StringBuilder sr = s.reverse();
  12.         System.out.println(sr);
  13.         System.out.println(s.toString().equals(sr.toString()));
  14.         }
  15.     }
  16. }
Add Comment
Please, Sign In to add comment