if in java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • atul123456789
    New Member
    • Jul 2007
    • 9

    #1

    if in java

    hi

    Do suggest wwr's problem/
    Y control is not entering if statement



    String city=request.ge tParameter("Cit y"); //line 1

    if (city== "Finddata" )
    {
    ...............
    .........
    }
    And city has value "Finddata" only.

    wen i comment line 1 and write String city="Finddata" , it works fine.
    Were can b the prob

    Thanks'
    Atul'
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by atul123456789
    if (city== "Finddata" )
    Don't compare Strings like that. If you had read the API documentation for the
    String class you could've seen that you do it this way:

    [code=java]
    if ("Finddata".equ als(city))
    [/code]

    kind regards,

    Jos

    Comment

    Working...