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

. En vez de ayudar a las otras abejas a recoger jugo de las flores, la abeja ____. pasa todo el día con su amiga, la serpiente disfruta del día volando y tomand
which is a safe practice when online
The___ relies on state and national funding to carry out programs
write an equation of a line with a y-intercept of −3 and an x-intercept of −4.5.
which statement best describes the domain of the function represented in the graph?
Can you get financial aid with average grades
Could someone please help me with this ASAP thank you
Write an equation that models the sequence -2, -6, -18, -54, ... A) y = -2x B) y = -2x2 C) y = -3x D) y = -2*3x - 1
Find the value of T?
What is the image of the point (0, 9) after a rotation 90° clockwise about the origin? A. (9, 0) B. (–9, 0) C. (0, –9) D. (9, 9)