Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.33 KB | None | 0 0
  1. public class StringEqualityTest {
  2.     public static void main(String args[]) {
  3.         String s1 = "abc";
  4.         String s2 = "abc";
  5.         String s3 = new String("abc");
  6.         String s4 = new String("abc");
  7.  
  8.         System.out.println(s1==s2);
  9.         System.out.println(s3==s4);
  10.         System.out.println(s1.equals(s2));
  11.         System.out.println(s1.equals(s3));
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement