New To Java - null

I need some help count all the character in a string. When I run my program it only count the first string. Thanks.

Here is my code

publicclass Strings

{

publicstaticvoid main(String[] args)

{

String s1;

String s2;

Scanner scan =new Scanner (System.in);

System.out.println("Enter the first string:");

s1 = scan.nextLine();

System.out.println("Enter the second string:");

s2 = scan.nextLine();

//Sting length of the characters

System.out.println("Sting Length of s1: " + s1.length());

System.out.println("Sting Length of s2: " + s2.length());

//Compare the characters

char ch1 = s1.charAt(0);

char ch2 = s2.charAt(0);

for (int count = 0; count < 1; count++){

if(ch1 < ch2)

System.out.print(s1 +" comes before " + s2);

if (s1.equals(s2))

System.out.println("The names are the same.");

else

System.out.print(s1 +" follows " + s2);

}

}

}

[1996 byte] By [tmlucky13a] at [2007-11-26 23:14:08]
# 1
if I asked you to count the number of letters in my first name, then asked you to count the number of letters in my surname, then asked you to count all the letters in my name, how would you do it?
georgemca at 2007-7-10 14:12:44 > top of Java-index,Java Essentials,New To Java...
# 2

I really don't know I had a hard figuring this out. I need it to count string 1 and then count string 2 and then compare them using the CharAt. I know that I need to change something in this part of the code, but I don't know what.

for ( int count = 0; count < 1; count++) {

if(ch1 < ch2)

System.out.print(s1 + " comes before " + s2);

if (s1.equals(s2))

System.out.println("The names are the same.");

else

System.out.print(s1 + " follows " + s2);

tmlucky13a at 2007-7-10 14:12:44 > top of Java-index,Java Essentials,New To Java...
# 3
Look at your for statement, how often do you think it will loop and why?for ( int count = 0; count < 1; count++) {Lima
LimaBravoa at 2007-7-10 14:12:44 > top of Java-index,Java Essentials,New To Java...
# 4

Also I might be wrong here (probably the case) but to me it seems that your logic isnt quite right either. If you had 2 strings:

String str1 = "Hallo";;

String str2 = "Hello";

Then both chars would be 'H'. So the first condition isnt met, the strings are not equal either so the second conditions isnt met, which means it defaults to your final condition. But this would say that str1 comes after str2 alphabetically, which isnt actually true.

Sorry if Im wrong and just confused you...

PaulOckleforda at 2007-7-10 14:12:44 > top of Java-index,Java Essentials,New To Java...
# 5
I guess it will loop one time because set it to one. So how would I get it to keep looping so that it will count the characters.
tmlucky13a at 2007-7-10 14:12:44 > top of Java-index,Java Essentials,New To Java...