Originally posted by marc weber:
I don't think so. Compare the results of trying to compile the following different cases:
x = x+++++y;
x = ((x++)++)+y;
x = (x++)+(++y);
And consider the significance of unary operator precedence over binary operators (e.g., ++ over +).
[ June 02, 2005: Message edited by: marc weber ]
so which is write
x = x+++++y;
x = ((x++)++)+y; //this is right or
x = (x++)+(++y); // this is right
actually when trying to compile the following program
class increment
{
public static void main(String args[])
{
int x=0;
int y=0;
int l=0;
l=x+++++y;
System.out.println("x="+x +" y= "+y+"l= "+l);
}
}
following error is comming..
D:\java_prac>javac increment.java
increment.java:9: unexpected type
required: variable
found : value
l=x+++++y;
^
1 error
why so ?
and also giving error when compiling
l=((x++)++)+y);
its not showing error when compiling like
l=(x++)+(++y);
???
pls reply