+ 1
I used an OR operator in my if-else statement, I put two integers in the condition separated by ||. Syntax error shows..Why??
So here goes: void getdata(int x, int y) if (x=1 || y=1) { System.out.println("xx") } It is showing a syntax error that this operator does not support int,int..
3 Answers
+ 2
you can not use that either assign values before and use it between x and y or do this
if you wanted this
(x==1||y==1)
or simply use x or y as Aditya said
you cannot call the value and assign it in same place. I don't know if there was reason for that but you can increment or decrement before doing so or make a function that toggles them and use that function if you want to make them true
+ 1
Thnx Sandeep, the == operator did the trick
0
operators