if(str){ , or if(!str){ can it work in java ?

Hello all

im kinda new to java I wander

in some scripting lang sometimes you can query if the variables is set or contains value that is different from "" (empty string 0 length)

by simply

doing

if(str){厖.}

or

if(!str){ ?.}

in java I notice you can't do it if your variable is not Boolean , or do I miss here something and there is way to do that somehow

can someone please make it more clear to me , tnx

[471 byte] By [Meirya] at [2007-10-3 2:21:41]
# 1
Correct. The expression must evaluate to true or false. You can check if str != null, or if str.length() > 0Kaj
kajbja at 2007-7-14 19:20:39 > top of Java-index,Java Essentials,New To Java...