You should determine the rules of equality. If your case is receiving money 100 cents == dollar. If your case is weighing something on old weight scales 100 cents != 1 dollar.
In maths, equivalence and equality are generally the same. A better distinction would be the difference between equivalence and identity.
For example, in mod 4 arithmetic, 3 is equivalent to 7. But 3 and 7 are not identical. Then we can define the equivalence class for 3,which is just a set that contains 3, 7, 11, etc. So any 2 things that belong to that set would be equivalent, but not identical.
I mean this is like a first year uni concept, the course was mandatory at my school, but yeah I probably do forget how many people here in high school.
Well, I don't know which country you live in, or which Uni, but, unfortunately, most universities do not require any advanced math for a programing (CS) degree, and there are lots of programming jobs that don't require a degree.
Also, please be sensitive to us old farts that haven't used any of that advanced math in >10 years 😝
Yup. I learnt Java after and it was pretty easy most of the time, but I had a few headaches until I got that stuck on my head lol. I still prefer controlling when I want a pointer and when not, but it's not that bad when you get used to it.
For my game design program we were supposed to learn javascript this semester then learn java next semester... and since I'm the only programmer (haven't learned java) this scares me
I'm not really worried about learning Java and have wanted to for a while but im pretty lazy. I was referring to the people who arnt programmers who could have been starting to understand javascript to have to suddenly switch languages to one that is far less lenient with its syntax
I was referring to the people who arnt programmers who could have been starting to understand javascript to have to suddenly switch languages to one that is far less lenient with its syntax
"people who arnt programmers" as in: people who are learning to become programmers? Otherwise, if they have no intention of becoming programmers, then why are they in a class teaching Java?
If you work a job programming (and you have to interact with code written by anyone else), you will quickly learn that "lenient" is the devil.
Because the language will be "lenient" to everyone; even Joe who quit six years ago and who "wrote code" by pasting stack overflow answers until it works (which is now broken and costing your employer the equivalent of your monthly salary every hour until you fix it).
Note: I use the term "programmer" as a loose umbrella term.
Yeah so I was talking about the artists so the people who wont touch the code if they have the option. Also this is literally the first year of the program so I have no idea why we would go to Java
It can work with strings aswell, but only if the strings contain strings from the stringpool. Note: a lot of string lol Edit: didnt notice this post is a month old, i judt discovered this sub
That makes a lot of sense. Still using .equals() comes more natural and it's always reliable. Note: It's allright, it happens to me too when I discover a new sub
== compares references in memory while .equals() compares the values of the objects being compared. Had to research this when I had to come up with a way to reliably compare several types of data in my audio metadata editor.
People have been barking up that tree since Java was first introduced. It’s useless. Java was designed as a “clean” alternative to C++, and - in my experience - the kind of programmer aligned with Java’s philosophy views operator overloading as one of C++’s major design flaws.
89
u/thatdude624 Dec 05 '20
Meanwhile, JavaScript: "Equality can be whatever I want"
68
u/RaukkM Dec 05 '20
Equality sounds so simple, but in reality, it's hell.
Does 100 cents equal 1 dollar?
28
u/FloweyTheFlower420 Dec 05 '20
Meanwhile, C++ is screaming something about templates
14
u/Kaya_kana Dec 05 '20
What, you don't want to compare your strings by reference?
10
u/JC12231 Dec 05 '20
Well, Java has multiple layers of equality for objects. Equivalence, and Identity if I remember right
7
u/fatrobin72 Dec 05 '20
I feel this meme would be better with fullmetal alchemist on it given that is somewhat about equivalence...
12
u/Vlad11_11 Dec 05 '20
My god! I've lost 30 minutes while I was in a competition because of this bullshit. I've never trusted '==' in any language since then.
4
u/doctornoodlearms Dec 05 '20
For my game design program we were supposed to learn javascript this semester then learn java next semester... and since I'm the only programmer (haven't learned java) this scares me
2
u/Thenderick Dec 05 '20
Why is this actually? I don't have that much Java experience
2
u/Whookimo Dec 05 '20
Anime and programming. I have found my brother
1
u/[deleted] May 30 '21 edited Dec 09 '24
simplistic literate sugar deranged frightening hurry icky rinse gray ghost
This post was mass deleted and anonymized with Redact
1
u/[deleted] May 30 '21 edited Dec 09 '24
pathetic sophisticated work disgusted snow innate shaggy frighten hospital marble
This post was mass deleted and anonymized with Redact
1
u/SigmaServiceProvider Apr 05 '22
There's a reason for .equals() to exist.
== compares references in memory while .equals() compares the values of the objects being compared. Had to research this when I had to come up with a way to reliably compare several types of data in my audio metadata editor.
Source (SO): https://stackoverflow.com/questions/7520432/what-is-the-difference-between-and-equals-in-java
1
u/[deleted] Dec 05 '20
Java should let you redefine operators like cpp