Dear Sampath,
Thanks its working
Can you please check following code? there are small problem in else part
if (str.equals("+"))
{
addval( no1, no2);
}
elseif (str.equals("-"));
{
subsval( no1, no2);
}
elseif (str.equals("*"))
;{
multval( no1, no2);
}
else;
{
System.out.println("Operator invalid.
Please enter valid operator (+,*,-)");
}
Nelson Rodrigo
Staff Officer - Software Development
LOADSTAR (PRIVATE) LIMITED
Sri Lanka | Tel: +94 11 483 7914 | Fax: +94 11 224 0892 | Mobile: +94 77 311
6556
P SAVE PAPER - Please consider our environment before printing *
_____
From: Rajeev Sampath [mailto:[email protected]]
Sent: Thursday, February 26, 2009 4:37 PM
To: [email protected]
Subject: Re: [java ee programming] Re: Input String Values
when you use '==' on an object, it compares only memory addresses - not the
actual content (in this case, the characters contained within string need to
be compared - not where it is stored.....). so don't compare string values
by references. use equals() method instead.
if (symbl.equals("+")) {
addval( no1, no2);
} else {
.....................
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Java
EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en
-~----------~----~----~----~------~----~------~--~---