kate1230 kate1230
  • 23-11-2018
  • Computers and Technology
contestada

What is the difference between = and == in terms of java..?

Respuesta :

tonb
tonb tonb
  • 23-11-2018

= 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 Link
camiliondez camiliondez
  • 14-10-2020

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!

Answer Link

Otras preguntas

That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government
How can I use the properties of integer exponents to simplify algebraic and numeric expressions ?
(14y) exponent of 4 simplify plz help
Find the Value of PT. PT=4x-6 and TQ=3x+4
Factor the expression.
Which is more precise grams or milligrams
Camp Timberlake has 320 campers in its first summer session. The oldest 112 campers sleep in tents and the rest sleep in cabins. The camp has 13 cabins and each
Victoria weighs 5/7 as much as mario. victoria weighs 125 lb. how much does mario weigh?
A boat costs $19,700 and decreases in value by 11% per year. How much will the boat be worth after 3 years?
2/3n-11=4+n Please write the steps.