What Does "!==" Mean In JAVA? - Codecademy

Skip to ContentProfile image of thibaultmonselSubmitted by thibaultmonselalmost 13 yearswhat does "!==" mean in JAVA?

thanks you for answering

Answer 515e2f402f68ece17c0005d3

0 votes

Permalink

I don’t think Java uses !==. Short answer: it means “not equal to”

Javascript, PHP and some others do, It is a strict comparison for “not equal”. Take the string “5” and the number 5. Using “5” !== 5, will NOT convert them to the same type. So “5” does not equal 5. (One is a number, the other a string)

You can go to: http://labs.codecademy.com/ Choose Javascript and test the difference:

if ("5" !== 5){ console.log("no way"); } else { console.log("yes it does!"); }

versus: “5” != 5 . Using only one = will convert them to the same type (probably a string) to see if they are they same. (The string “5” and the number 5, will be the same, because they were converted to the same type before the comparison)

if ("5" != 5){ console.log("no way"); } else { console.log("yes it does!"); }

One could argue that === and !== are faster than == and != as there is not need to convert the type or check to see if it needs to convert the type.

Profile image of enviaSubmitted by enviaalmost 13 years

Popular free courses

  • Free course

    Learn SQL

    In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
    • Checker DenseBeginner Friendly.4 Lessons
  • Free course

    Learn JavaScript

    Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Checker DenseBeginner Friendly.11 Lessons
  • Free course

    Learn HTML

    Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.
    • Checker DenseBeginner Friendly.6 Lessons
Explore full catalog

Tag » What Does A Mean In Java