Checking Equality in Java ( == vs equals method )

  Рет қаралды 8,270

Bill Barnum

Bill Barnum

Күн бұрын

Пікірлер: 23
@BillBarnum
@BillBarnum 4 жыл бұрын
📌 Subscribe For The Latest Videos: bit.ly/36H70sy 📌 . 💻 All Java Tutorials: bit.ly/JavaTutorialsKZbin 💻 . 🤖 Learn Java In 3 Hours: bit.ly/JavaIn3Hours 🤖
@foamersimpson6690
@foamersimpson6690 Жыл бұрын
These videos are amazing and help me understand concepts that I didn't even know existed. Thank you bill!
@abhisheknagarkar6254
@abhisheknagarkar6254 3 жыл бұрын
Really liked your video.. Super awesome explanations with just the right amount of info so a person watching the video isn't flooded !
@BillBarnum
@BillBarnum 2 жыл бұрын
Awesome, thank you!
@glokta1
@glokta1 4 жыл бұрын
God bless you, I've been racking my brain against this for hours and this video was exactly what I needed. Very clear presentation. Your "Primitive vs Reference Type Objects in Memory" was also very helpful. Thanks a lot!
@BillBarnum
@BillBarnum 4 жыл бұрын
Thanks for the feedback.
@sergeiflozov91
@sergeiflozov91 4 жыл бұрын
Seems like there is a typo in 11:00 .. the quotation is not closed inside the parentheses of the println method in the second if statement! Your video is helping me a lot Thanks ^^
@BillBarnum
@BillBarnum 4 жыл бұрын
Wow, good catch!
@PrinceZam
@PrinceZam 3 жыл бұрын
Wow this is really cool 🗣💯
@BillBarnum
@BillBarnum 3 жыл бұрын
Thanks for the feedback. I'm glad you liked the video!
@satioOeinas
@satioOeinas 2 жыл бұрын
great video.
@cheribgh275
@cheribgh275 Жыл бұрын
Hi Bill, can we initialize arraylist like this? List myList = new ArrayList(); I mean is this the right way?
@BillBarnum
@BillBarnum Жыл бұрын
That would be fine. Alternatively: ArrayList myList = new ArrayList(); ArrayList Video: kzbin.info/www/bejne/nnvSk4J5hbOhqcU&pp=ygUOYXJyYXlsaXN0IGphdmE%3D
@Bettle
@Bettle 4 жыл бұрын
Good job
@RakibHasan-455
@RakibHasan-455 3 жыл бұрын
7:44 can anyone tell me why it returns false,,, but in Arraylist it returns true..
@BillBarnum
@BillBarnum 3 жыл бұрын
Good question. The Java object class includes an equals method that checks if the variables point at the same object. For classes, like arrays, that inherit the equals from the Java object class, using == and .equals() is equivalent. In classes like ArrayList, the .equals() method was overridden, and it actually checks the VALUES in the objects the variables are pointing at. In those cases, using .equals will return true if the two variables point at different objects with equal values. I don't have a video on it, but if you search KZbin for "overriding equals java," you can learn what it means to override the equals method. If you want to learn more about inheritance in general, or overriding in general, I have some videos on those topics: kzbin.info/aero/PLmpmyPywZ443dRtMleUPoNp2OyiNE45O6
@RakibHasan-455
@RakibHasan-455 3 жыл бұрын
@@BillBarnum Thanks man!
@kimsungho4114
@kimsungho4114 3 жыл бұрын
I watched all the ads for you :)
@makemusic1014
@makemusic1014 3 жыл бұрын
I wish u were my tutor
@sdanikazmi
@sdanikazmi 2 жыл бұрын
7:50 mistake on line a.equals(c) will be true.
@BillBarnum
@BillBarnum 2 жыл бұрын
Syed, This is an example of how confusing it can be to check equality in Java. While they are equivalent arrays, if you compare them that way, it will evaluate to false because the variables aren't pointing at the same object. At 11:20, I talk about the correct way to check the equivalency of two arrays.
@ZXu-mj9gm
@ZXu-mj9gm 4 жыл бұрын
👍
@BillBarnum
@BillBarnum 4 жыл бұрын
Thanks for the feedback!
What is null and a null pointer exception? (Java Tutorial)
6:14
Bill Barnum
Рет қаралды 19 М.
Generics In Java - Full Simple Tutorial
17:34
Coding with John
Рет қаралды 1,1 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Difference Between "== Operator" And "equals() Method" In Java (Hindi)
15:02
Array vs. ArrayList in Java Tutorial - What's The Difference?
17:36
Coding with John
Рет қаралды 572 М.
Primitive Types and Reference Types in Java
6:28
Neso Academy
Рет қаралды 145 М.
Java Stack + Heap with Reference & Instance Variables
23:58
Job Ready Programmer
Рет қаралды 225 М.
.equals() vs. == in Java - The Real Difference
8:48
Coding with John
Рет қаралды 199 М.
Getters & Setters (Java Tutorial)
8:47
Bill Barnum
Рет қаралды 4,2 М.
Full Computer Science Degree in a Nutshell
20:39
MrAlgorithm
Рет қаралды 108 М.
The Genius Way Computers Multiply Big Numbers
22:04
PurpleMind
Рет қаралды 247 М.
Checked vs. Unchecked Exceptions in Java Tutorial - What's The Difference?
10:14
I made maps that show time instead of space
10:44
Václav Volhejn
Рет қаралды 975 М.