Originally posted by levani dvalishvili:
yes , I realized putting a parens around solves the problem, but look at this example then :
String name = "hello";
System.out.println(name=null==null?name:"Not specified");
Output is : hello
here comparison happens first and then assignment.
even without parens, I would asume name would be assigned null first then comparison and output would be null.
???
getting confused about precedence order
[ February 02, 2006: Message edited by: levani dvalishvili ]
Why would name be set to null. You are comparing null to null and if they are the same, name is assigned to the value of name. name isn't assigned to null.