Comparing to string with each other in Java
<p>I'm looking for a solution to compare two strings with each other. I have already found a few suggestions but i'm not really understanding how to do it. I want to do something like that:</p>

<pre><code>String a = 23;
String b = 2;

if (a &lt; b)
System.out.println("...");
else ..
</code></pre>

<p>I've found the compareTo method but i don't get the idea behind it. The code would be something like:</p>

<pre><code>String a = 23;
String b = 2;

if (a.compareTo(b) &lt; 0)
System.out.println("...");
else ..
</code></pre>

<p>But why should i compare to strings with each other and then compare it to zero?? I'm really confused.</p>
