hi ben,

1) You can use equal method for string comparison -ex.  
age.equal(ageInputString)
2) In order to get the largest value, first you need to convert it from string 
to integer (ex.  int ageint = Integer.parseInt(age)) . To get the maximum 
value, you may need to use math.max() method or conditional if below.

Example
     
        max = (num1 > num2) ? num1 : num2;
        max = (max > num3) ? max : num3;

regards

sam

 

________________________________
From: ben <[email protected]>
To: Free Java Programming Online Training Course By Sang Shin 
<[email protected]>
Sent: Wednesday, July 22, 2009 9:32:44 AM
Subject: [java programming] comparing strings


hi all,

i want to know how to compare strings...
for example if i get the age as a string... how can i compare them and
get the largest value to print...

thanks

ben...



      
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to