+ 1

What means ==?

I don't really know what "==" stands for. Can someone help me?

27th Oct 2016, 8:38 PM
Caway
Caway - avatar
9 odpowiedzi
+ 4
For primitives types, the "==" operator denotes equality. As for objects it denotes whether a certain object points at a certain location within memory.
27th Oct 2016, 8:44 PM
Ousmane Diaw
+ 3
Sure i can. Using "==" For primitives : int numOne = 3; int numTwo = 7; if(numOne == numTwo){ // they are equal }else{ // they are NOT equal } Using "==" for objects: Class Tester{ public Tester(){ } } Tester t1 = new Tester(); Tester t2 = new Tester(); if(t1 == t2 ){ // they are objects of the same type }else{ // they are NOT objects of same type } To be honest it might also help to read the oracle java tutorials regarding it.
27th Oct 2016, 8:56 PM
Ousmane Diaw
+ 3
EQUALLY OPERATOR: The equality operator (==) is used to compare two values or expressions. It is used to compare numbers, strings, Boolean values, variables, objects, arrays, or functions. The result is TRUE if the expressions are equal and FALSE otherwise. ASSIGNMENT OPERATOR: The assignment operator (=) is used to assign a value to a variable, element of an array, or property of an object ..
1st Jun 2017, 4:14 PM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
+ 1
An = is used to attribute a value to a variable ex in javascript: var fName = "Tim"; An == is used in a logical comparison, in an If-statement ex in javascript If (fName == 'Tim') { var result = "Hello I am Tim"; } else { var result = "Hello I am somebody else"; }
27th Oct 2016, 8:53 PM
Richert Van Impe
+ 1
I have read it but I didn't understood it. Anyway, thank you @Ousmane!
27th Oct 2016, 8:58 PM
Caway
Caway - avatar
+ 1
== is logical operator which means equal(=) inside every loops like if, if else, else if etc logical operators are necessary to execute code. otherwise it will show error message. other logical operators are: <= is less than or equal >= is more than or equal && and || or u will learn more about it in upcomming modules.
1st Nov 2016, 8:58 AM
Sahil
Sahil - avatar
+ 1
Ok simplest answer here people. == means equal to. Simple
28th Dec 2017, 3:47 PM
Derek Leiro
Derek Leiro - avatar
0
@Ousmane Okay, thank you .... Can you give an example?
27th Oct 2016, 8:47 PM
Caway
Caway - avatar
0
@Caway C, you might want to explore the basics on tutorialspoint and also you must practise it. I find just reading something is ineffective if you dont put it to practise. Good luck anyway!
27th Oct 2016, 10:11 PM
Ousmane Diaw