Java Blog

 
 
 
 public class JAVA_046
 {

    public static void main(String[] args)
    {
       String String1=\"Too many \";
       String String2=\"cooks\";
       String String3=\"Too many cooks\";

       String1+=String2;

       System.out.println(\"Test # 1\");
       System.out.println(\"String3 is now : \" + String3);
       System.out.println(\"String1 is now : \" + String1);

       if(String1.equals(String3))
          System.out.println(\"String1.equals(String3) is True, so Strings are equal\");

       else
          System.out.println(\"String1.equals(String3) is False, so Strings are not equal\");

       String3=\"TOO many cooks\";

       System.out.println(\"\\n\\nTest # 2\");
       System.out.println(\"String3 is now : \" + String3);
       System.out.println(\"String1 is now : \" + String1);

       if(String1.equals(String3))
          System.out.println(\"String1.equals(String3) is True, so Strings are equal\");

       else
          System.out.println(\"String1.equals(String3) is False, so Strings are not equal\");

       if(String1.equalsIgnoreCase(String3))
          System.out.println(\"String1.equalsIgnoreCase(String3) is True, \" +
                                                       \"so Strings are equal ignoring case\");

       else
          System.out.println(\"String1.equalsIgnoreCase(String3) is False, \" + 
                                                                 \"so Strings are different\");
    }
 }

    Related Post:
  1. Program to show an example of using a Static Nested Class outside the Top-Level Class

  2. Program to append a StringBuffer by StringBuffer, String objects and other Basic Data Types

  3. Program to show the use of Conditional (Ternary) Operator

  4. corba program of client and a DNS server where given a URL the server sends back an IP address

  5. Program to show the comparing of Strings for equality

  6. Program to evaluate following investment equation V=P(1+R)^N

  7. File handling program to copy bytes from one file to another

  8. An applet program to find maximum of three numbers using textField

  9. RMI based application for login validation based on data saved in text file stored on the server and will display appropriate message to the client..

  10. RMI servlet program to display message

  11. Program that will read real number from the keyboard and print the following output in one line: small Integer not less The Given Number Largest Int

  12. Program to declare, initialize and print an array of integers

  13. Program to show the use of Bitwise Operator (&) AND

  14. RMI program of count server and client

  15. Program to display following things on the client machine a)date and time of the server machine b)date and time of the client machine and difference

  16. Program sets up a String variable containing a paragraph of text of your choice. Extract the words from the text and sort them into alphabetical order

  17. Program to declare, initialize and print an array of characters

  18. Program to show an example of modifying String objects

  19. Program of linear search

  20. Program to show the use of operator (>>) Shift Right, propagating the sign bit from the left

 
 
Didn't find what you were looking for? Find more on Program to show the comparing of Strings for equality