any other way to find char array length?
- by user2785137
public static int getLenth(char[] t)
{
int i=0;
int count=0;
try
{
while(t[i]!='\0')
{
++count;
i++;
}
return count;
}
catch(ArrayIndexOutOfBoundsException aiobe)
{
return count;
}
}
This method returns length of charArray. But my question is, is there is some other "ways" to find the length of charArray without using this try, catch statements & all ??
Thanks in advance :)