+ 1

What is the true function of the operator (===)?

what does it do?

2nd Mar 2017, 2:30 PM
AsheEvelineRose
AsheEvelineRose - avatar
9 odpowiedzi
+ 5
it returns true if both the value and the data type is same among the operand variables
2nd Mar 2017, 3:40 PM
Ronit Kumar
Ronit Kumar - avatar
+ 4
its also used for arrays in java. like eg:a===b is true if both a & b have same order, same value and same type.
2nd Mar 2017, 3:25 PM
Ahmed Shah Malik
Ahmed Shah Malik - avatar
+ 4
its "mohsin" @rose. well my teachers also make mistake while they call my name. :)
2nd Mar 2017, 3:29 PM
Ahmed Shah Malik
Ahmed Shah Malik - avatar
+ 1
thank you moshin
2nd Mar 2017, 3:26 PM
AsheEvelineRose
AsheEvelineRose - avatar
+ 1
I just mistyped it mohsin but still thank u 4 your answer
2nd Mar 2017, 3:30 PM
AsheEvelineRose
AsheEvelineRose - avatar
+ 1
may be you got your answer..then also., === means "identical to" if both value and datatype are same then it gives 1 or true..otherwise 0 or false.
2nd Mar 2017, 6:34 PM
Ashish Dhaka
Ashish Dhaka - avatar
0
It checks the value and data type, Int a=1 Int b=1 Char c='1' Double d=1.0 a===b returns true a===c returns false a===d returns false
2nd Mar 2017, 2:54 PM
Alejandro Serrato
Alejandro Serrato - avatar
0
If you mean == it means if it is equal, and = is to asign it. So if you write if(a = b) it is like you are asigning b to a in the if statement, resulting in a syntax error
8th Mar 2017, 3:53 PM
strangelf47829
strangelf47829 - avatar
- 1
if im not mistaken it check if the type is the same. int a = 1; int b = 2; char c = z; c===b return false. a===b return true.
2nd Mar 2017, 2:39 PM
Jordi sarrato
Jordi sarrato - avatar