Quote:
Originally Posted by fresher
thanks for your reply but is network.trim() a java function
|
Yes, and a quick Google or a look at the Sun javadocs would
tell you all about it
Quote:
Originally Posted by fresher
and what is the meaning of " ".equals..... please? a little comment will be perfect. thanks in advance
|
To check whether two strings, a and b, are equal, you'd use the following code:
If b is null, then the above expression returns false. If a is null, then an exception is raised, because you can't have null.equals(b).
So when comparing a string whose value could possibly be null (i.e. network), against a string whose value cannot be null (i.e. ""), then it's best to have the string that cannot be null as the one on the left, and the string that can be null on the right.
"".equals(stringThatMightBeNull) // false when null
stringThatMightBeNull.equals("") // error when null