Thanks Paul
I may have missed something in those statements
How about :

String str = new Class1().getStr(); // where getStr returns String

if(str.equals("SOMESTRING")){
//// Some process;
}
OR
if(str.equals(Class1.getStr())){
// some process here;
}

Thanks again


"Paul Clapham" <pclapham@core-mark.com> wrote:
>The behaviour of these statements is to produce a compile-time error, since
>they are not valid Java statements.
>
>PC2
>
>"complex" <com@com.com> wrote in message news:3c55699d$1@10.1.10.29...
>>
>> Can any one help me by explaining the behavior of below mentioned scenario
>>
>> (1) String str = new Class1.getStr();
>> What happens to the instance of Class1
>>
>> (2) if (String str = new Class1.getStr().equals("MYNAME"));
>> What happens to the instance of Class1 if i would use this statement
>> rather then #1
>>
>> Thanks
>>

>
>