[JAVA] Unicode Characters and string copying/comparison

Hey all,
I normally do C++ but lately ive been learning some Java, due to my CIT/TAFE course doing Java next semester.
Anyway so ive been on [COLOR=Blue]www.net-force.nl[/COLOR] doing some of the challenges they have over there, just to get to know Java better.
[SIZE=2]NOTE: The terms and conditions of doing the challenges state that NO-ONE is to give me the answer/password, or help me on the challenges.
so please DO NOT give me the answer/password.
[/SIZE]

Im not asking for help on the challenge, but just some Java stuff that is used in the challenge.


    public applet4()
    {
        SubmitButton = null;
        PasswordField = null;
        SubmitButton = null;
        PasswordField = null;
        SubmitButton = new Button();
        PasswordField = new TextField("", 8);
    }

    public void actionPerformed(ActionEvent actionevent)
    {
        String s = PasswordField.getText();
        String s1 = getDocumentBase().toString();
        char c = '\u01C0';
        int i = hash(s);
        s1 = s1.substring(0, s1.lastIndexOf('/') + 1);
        String s2;
        if(c == i)
            s2 = s1 + "index.php?pass=" + s;
        else
            s2 = s1 + "index.php?pass=kneus";
        try
        {
            getAppletContext().showDocument(new URL(s2), "_self");
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
    }

    private int hash(String s)
    {
        int i = 0;
        for(int j = 0; j < s.length(); j++)
            i += s.charAt(j);

        return i;
    }

ok so thats part of the code.

Q1
The thing I would like to know is with this line of code:
PasswordField = new TextField("", 8);
then,
String s = PasswordField.getText();

Say I put “cats” in the password field, when the field value is copied into String s will String s then equal [COLOR=Navy]“cats”[/COLOR] or will the rest of password field (8 characters long) be placed into it with other null characters or something? Like this [COLOR=Navy]“cats\0\0\0\0”[/COLOR][COLOR=Black]? :stare:[/COLOR]

Q2
As you can also see a comparison is made between char c and int i (return of hash(s))


if(c == i)
            s2 = s1 + "index.php?pass=" + s;

and as you can also see, c = ‘\u01C0’;
So when the comparison is made “if(c == i)” will c be seen as ‘\u01C0’ or the latin character ‘ǀ’?
And mainly, how the hell can you compare a character and an integer?!?!

Im not sure if im even doing this the right way, but as i quoted at the start, no-one is to help with the challenge, or give out the answer/password!
But your welcome to sign up and do it yourself :wink: (just dont show me up too much =P)

I appreciate all the help you all always give me.
Cheers.