Respuesta :
= is for assignment, == is for comparison.
So x=2 means: assign the value 2 to the variable x.
and
x==2 means: is variable x equal to 2, yes or no?
Answer:
= is used more for define a variable so int Data = 1;
Where == is used to show if something is equal too.
exp of == would be
int Data1 = 1;
int Data2 = 2;
if(Data1 == Data2)
{
System.out.println("Hi")
}
else
System.out.println("Not Equal");
//Output
Not Equal
//Reason was they didnt equal and the boolean was false not true.
Explanation:
Hope this helped!