The reason why these are not equal is because you are performing an equality test against the objects themselves. This is false because these are two different objects and the equality operator is telling you s and cs are not the same object.
However, you can use the == operator to compare equality of string literal values. E.g. String x = "My String";
In Java, string literals are interned, so only one copy of a unique string literal value can exist within a a running Java JVM.
Likewise, if you create a string reference and assign it to an existing string value, you can use the == operator to compare equality. E.g., String y = x;
In this case x and y are equal because they reference the same object.
Another important thing to remember with regards to using the equal method for Objects you create yourself is that by default the equals method you inherit from Object will use object identity for comparison, meaning it will return false if the objects being compared are different objects. If you want to use instance variables within a given object to determine equality, you must override the equals method of your object. And you must also override the hashCode method. Two Objects' hash code must be the same if they are equal. If you use an IDE like NetBeans or Eclipse, you can override equals and hashCode with a couple of mouse clicks.
See my below example for more details about String equality in Java:
String a = "test";
String b = "test";
System.out.println(a==b); //This will print true same String literal
String c = b;
System.out.println(b==c); //This will print true same String literal
//NEVER, NEVER use String's String construct to make Strings,
//it creates unnecessary objects which can cause resources issues
String d = new String("test");
System.out.println(a==d); //This will print false different String Object
String e = d;
System.out.println(e==d); //This will print true same String Object
// Again, NEVER, NEVER use String's String construct to make Strings,
//it creates unnecessary objects which can cause resources issues
String f = new String(d);
System.out.println(f==d); //This will print false different String Object