Is it possible to return a string?

I try to get the password from a password field. But I couldnt. I try to write a method which change Char[] to a string. Here is my code:

privatestatic string SifreyiAl(char[] Chr){

String Str ="";

for(int i = 0, i < Chr.length, i++){

Str += Chr[i];

}

return Str;

}

Why doesnt it work?

Message was edited by:

Genomsaren

[719 byte] By [Genomsarena] at [2007-11-27 7:36:30]
# 1
String starts with a capital S.
CaptainMorgan08a at 2007-7-12 19:17:01 > top of Java-index,Java Essentials,New To Java...
# 2
Are you concerned with security? That is why passwords are held in char arrays, not Strings -- you can blank out a char array.If you are not worried about security, check out the String constructors. There is an easier way to do what you are trying to do.
Hippolytea at 2007-7-12 19:17:01 > top of Java-index,Java Essentials,New To Java...
# 3
Also, for loop need semicolons, not commas to separate the fields.
hunter9000a at 2007-7-12 19:17:01 > top of Java-index,Java Essentials,New To Java...
# 4
any particular reason for not using:String Str = new String(Chr);
DarumAa at 2007-7-12 19:17:01 > top of Java-index,Java Essentials,New To Java...
# 5
I have corrected it thanks! I should write ";" nd not "," . VB's conventions...
Genomsarena at 2007-7-12 19:17:01 > top of Java-index,Java Essentials,New To Java...