IF ELSE help

Hi,

I know this is a simple question but my script does not seem to be working.

I basically want to write out a variable if it has some data if not I want to write out some others.

if(session.getVariable( "POSTCODE" ) !="")
{ out.write( "
" + session.getVariable( "POSTCODE" ) + "\n" );
}
else
{ out.write( "
" + session.getVariable( "STREET" ) + ", " + session.getVariable( "COUNTY" ) + "\n" );
}

Any ideas?

String comparison

Solved it, I needed to use a different comparison operator

//if(String a1.equals(String a2))
if(session.getVariable( "POSTCODE" ).equals("-")){
                out.write&#40; "<postcode>" + session.getVariable&#40; "STREET" &#41; + ", " + session.getVariable&#40; "COUNTY" &#41; + "</postcode>\n" &#41;;
        &#125; else &#123;
                out.write&#40; "<postcode>" +  session.getVariable&#40; "POSTCODE" &#41; + "</postcode>\n" &#41;;
        &#125;