I think that Mong-Thao La wrote: >>i have following method in java code: >>public String getVerificationDescription(String verificationID) { >> if(verificationID.equals("Knicknachweis")) >> return "Test" ; >>}
>>I will not work ! >>It is not a big problem, but i can not find the error. Hi Mong-Thao, Well, while this most definitely a basic Java question and *not* a Jess question, Ernest does follow an unwritten Hippocratic Oath about such matters. So... The problem is that your code does not account for what happens if verificationID is *not* equal to "Knicknachweis", so the method does nothing if it's not equal. Since the method must return a String, this is not going to work. Run this class and see if it's what you want: // ==================================== public class TestMethod { public static void main(String[] args) { // A bunch of test calls TestMethod tm = new TestMethod(); tm.getVerificationDescription("fooBAr"); tm.getVerificationDescription("Knicknachweis"); tm.getVerificationDescription(""); } public TestMethod() { } public String getVerificationDescription(String verificationID) { StringBuffer message = new StringBuffer(); if (verificationID.equals("Knicknachweis")) { message.append("Test"); System.out.println(message.toString() + ": Verified " + verificationID); } else { message.append("Failed!"); System.err.println(message.toString() + ": Could not verify " + verificationID); } // Only return from method in one statement return message.toString(); } } // ==================================== Output: -------- Failed!: Could not verify fooBAr Test: Verified Knicknachweis Failed!: Could not verify Some suggestions would be: (1) If you use an IDE like Eclipse www.eclipse.org, you will see errors like this immediately as you write your code. (2) Only return from your methods in one statement. In other words, don't have multiple return statements in your methods (if you can avoid them). (3) Use brackets on your control statement blocks even if they only contain one statement right now...this can always change later and it makes your code more organized. In the future, you may want to post this type of question to a more general Java users group. One that I can recommend is the one to which I belong www.pjug.org and http://www.pjug.org/mailman/listinfo/javamail -- a very knowledgeable and friendly bunch of folks. Hope this helps! Cheers, Jason ------------------------ Jason Morris Morris Technical Solutions [EMAIL PROTECTED] www.morristechnicalsolutions.com fax/phone: 503.692.1088 -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------