| | |
boolean return problem
Thread Solved |
Hey guys, I have one stupid problem with the return value of one function... this is my code:
...and if the mail is daniweb@hotmail.com then mail.substring(N) will be hotmail.com but the return value will be false.
Where is my mistake?
Thanks.
Java Syntax (Toggle Plain Text)
private boolean check(String mail, int N){ // mail = The mail // N = The sum of the characters before the @ and including it him if(mail.substring(N) == "hotmail.com" || mail.substring(N) == "live.com" || mail.substring(N) == "msn.com" || mail.substring(N) == "yahoo.com" || mail.substring(N) == "gmail.com"){ return true; } else { return false; } }
...and if the mail is daniweb@hotmail.com then mail.substring(N) will be hotmail.com but the return value will be false.
Where is my mistake?
Thanks.
•
•
Join Date: Apr 2008
Posts: 972
Reputation:
Solved Threads: 146
0
#4 Oct 14th, 2009
ps
is just the long way to say
Java Syntax (Toggle Plain Text)
if (some boolean expression) { return true; } else { return false; }
Java Syntax (Toggle Plain Text)
return (some boolean expression);
![]() |
Similar Threads
- Comparing Images For Similarity (Java)
- execvp return help... (C)
- AnsiString Template Data Return Problem Builder 6 (C++)
- help with first and second problem (C++)
- problem in java cobe (Java)
Other Threads in the Java Forum
- Previous Thread: help me if you want to, i really dont care
- Next Thread: JOptioPane-Determining the output integer
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game gameprogramming givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working





