How to swap 2 variables (real life example) 🥤

  Рет қаралды 123,546

Bro Code

Bro Code

Күн бұрын

Java switch/swap two variables
#Java #switch #swap #variables

Пікірлер: 572
@BroCodez
@BroCodez 4 жыл бұрын
Drinking game: Take a drink everytime I say the word 'VaRiAbLe' //************************************************ public class Main { public static void main(String[] args) { String x = "water"; String y = "Kool-Aid"; String temp; temp = x; x=y; y=temp; System.out.println("x: "+x); System.out.println("y: "+y); } } //************************************************
@F2_CPB
@F2_CPB 2 жыл бұрын
I know I'm late to party But me after drinking game: String Result = 1:32
@treebit
@treebit 4 жыл бұрын
That's what I call visualisation!
@editIQYT
@editIQYT Жыл бұрын
Fixing commentsc
@nathanlutz4144
@nathanlutz4144 6 ай бұрын
And it’s thirsty 😂
@haroldw2823
@haroldw2823 3 жыл бұрын
Dude that visual representation of switching content was the best I've seen. It actually has me thinking about programming in a different way now. Well done mate!!!!
@АлексейСоловьёв-ь3щ5ш
@АлексейСоловьёв-ь3щ5ш 3 жыл бұрын
This is the most obvious explanation for beginners I've ever seen. Thank you, bro!
@bluebodycamera
@bluebodycamera 3 жыл бұрын
Visual teaching is always great, its even better when the visuals are funny!
@laylachisom8996
@laylachisom8996 Жыл бұрын
It’s not very often I find a teacher I understand on KZbin for Java , but I now have Thanks for making it easy to understand!!
@huuloc8719
@huuloc8719 2 жыл бұрын
Today, I start learning OOP in Java. Thank you so much for this free course. I will comment on every video I have learned.
@BroCodez
@BroCodez 2 жыл бұрын
yay!
@nailpluckers
@nailpluckers 3 жыл бұрын
int a = 10, b = 20; int temp = 0 ; temp = a ; a = b ; b = temp; System.out.println(" The value of a is : " + a ) ; System.out.println(" The value of b is: " + b) ; Yay! Swapped the variable! :)
@sushantlama9010
@sushantlama9010 3 жыл бұрын
Best explanation in the KZbin history......
@GeoffreyofCastille
@GeoffreyofCastille 3 жыл бұрын
Found your channel looking for help in JavaFX - taking an online college course in Java and my instructor's idea of teaching is assigning a chapter to read, assigning a single program, assigning a quiz....and that's it. Watched your first JavaFX video and decided to start at the top because your videos are 1000% more useful than my class. Subscribed!
@bluehue12
@bluehue12 Жыл бұрын
I feel you on that. I am currently enrolled in Coding Dojo part time online, and it is the same teaching strategy. I am learning more from Coursera and youtube videos 😂
@mercycebu2896
@mercycebu2896 3 жыл бұрын
I'm a begginer in java programming and your tutorials helps me a lot♥️
@snekeater980
@snekeater980 Жыл бұрын
public class SwitchingVariables { public static void main(String[] args) { String Mug = "Coffee"; String Glass = "Milk"; String ExtraCup; ExtraCup = Mug; Mug = Glass; Glass = ExtraCup; System.out.println("Mug with "+Mug); System.out.print("Glass with "+Glass); } } It was very easy to understand when you did the Water and Kool-aid showcase
@snzero5438
@snzero5438 Жыл бұрын
i like your Variables names
@rekan_98
@rekan_98 3 жыл бұрын
I have been started studying at the university for 3 years ,but this helped me a lot to understand the swapping logic thanks
@rohan0070
@rohan0070 2 ай бұрын
Now I really Understood how Variables are Swapped, Thanks for the Real Life Explanation.
@drone-Eye
@drone-Eye 2 жыл бұрын
Bro, I had Java-phobia, but thanks to you that's faded. Simply, great work brooooo!!!
@selerdem1391
@selerdem1391 3 жыл бұрын
honestly bro ur videos are so helpful learning java because its not being presented as a robot professor who just reads out of the book in all of my courses. def gonna recommend u to all my classmates.
@PhilosoCoder
@PhilosoCoder 2 жыл бұрын
Awesome, cool in style and teaching method.
@sadatishraq6020
@sadatishraq6020 6 ай бұрын
you're one of those GOATED teacher! Love you!!
@AIMENABDU
@AIMENABDU Жыл бұрын
you saving lives out here .. thank you "Michael Scott impression"
@chunmaroo
@chunmaroo 4 жыл бұрын
I'm still have a bunch of school homework now. after all of these, I will watch your newest java tutorials 😊
@mansalek
@mansalek 2 жыл бұрын
that visual representation was genius bro
@selmanozturk6816
@selmanozturk6816 Жыл бұрын
Such a great visual expression.
@Google_Engineer
@Google_Engineer 3 жыл бұрын
Wow!! Godfather of youtube Teachers ,♥️🙏
@annderby6295
@annderby6295 3 жыл бұрын
Awesome teaching technique - use of a real life illustration that people can relate to. Nice! Empty the contents of cup X into cup TEMP, now cup X is empty. Empty the contents of cup Y into cup X, now cup Y is empty. Empty the contents of cup TEMP into cup Y, now cup TEMP is empty & cups X & Y are full.
@Sanyam1010
@Sanyam1010 4 ай бұрын
thank you so much I am watching one lesson every day 🤓, trying to learn java from your videos ,keep it up 👍
@JuliHoffman
@JuliHoffman 2 жыл бұрын
Sorry about your floor, Bro. This visualization actually made sense! Thank you!!!
@rohitgiri9266
@rohitgiri9266 3 жыл бұрын
I like the way of you Teach!❤❤😍😍 - Love Programming
@m.s.mehedihasan
@m.s.mehedihasan 3 жыл бұрын
you are so good as a teacher. I am loving your tutorial.
@Ushiwakamaru_BAU_BAU
@Ushiwakamaru_BAU_BAU 2 жыл бұрын
My brain just melted from this very simple demonstration... A new window has opened for me.
@aryanmn1569
@aryanmn1569 3 жыл бұрын
u r such a bro, and I simply don't get tired to spam your comments with appreciation
@bloggingbyasifali4984
@bloggingbyasifali4984 10 ай бұрын
Ur teaching was clear and crystal ❤❤
@sankartechpro
@sankartechpro 4 жыл бұрын
Really awesome with real world examples. You're super.
@scholar0098
@scholar0098 7 ай бұрын
best coding teacher cant express how good he teaches
@玉姬-z4z
@玉姬-z4z 2 ай бұрын
very interesting explanation
@seguchi3333
@seguchi3333 3 жыл бұрын
Thank Bro Code. I could learn java code in English. Step by step , I will watch your video in japan.
@amandoktorcanimkuzumdoktor5193
@amandoktorcanimkuzumdoktor5193 3 жыл бұрын
Did you finish watching all of them 100 videos, bro?
@local_gymbro
@local_gymbro 9 ай бұрын
Here's my example how I practiced it today: public class VariableSwitch { public static void main(String[] args) { String x = "Catfood"; String y = "Dogfood"; String temp = null; x = temp; x = y; y = temp; System.out.println("x:" + x); System.out.println("y:" + y); } } Just basic sh but you still helped me out a lot. Thank you
@alwaysmotivativated7774
@alwaysmotivativated7774 4 ай бұрын
I had not ever watched that type of wonderful visulation ❤ Amazing 🤝
@husein_alfil
@husein_alfil 3 жыл бұрын
Amazing genius explaining !! Keep that great method ! I subscribed 2 times 😄
@CPawnch
@CPawnch Ай бұрын
Thanks for another video Bro! I'm still quite new to this so I don't understand the purpose of switching variables. Hoping to learn more and answers as I watch your videos!
@maxjustmax521
@maxjustmax521 3 жыл бұрын
Bro you are awesome and a lot of fun to study with!
@ryannayak5797
@ryannayak5797 3 жыл бұрын
really loved your way of teaching!
@lucathebrainrot
@lucathebrainrot 2 жыл бұрын
Breathtaking visuals.
@TheAnuNay
@TheAnuNay 6 ай бұрын
I am watching it in March 2024 and found the coolest way to understand.
@honeybutter7074
@honeybutter7074 2 жыл бұрын
Omg I love this visualization. Can't even mix that logic with this explanation. TYSM.
@EsmatullahSayed
@EsmatullahSayed Жыл бұрын
I really liked the way that you swap the variable value with showing live example.
@alimustafaali2802
@alimustafaali2802 3 жыл бұрын
really loved your way of teaching
@99Hitsugaya
@99Hitsugaya 3 жыл бұрын
Well that live demo was fun :)
@niladri.g2334
@niladri.g2334 11 күн бұрын
Perfect channel to learn programming
@kirillutsenko9306
@kirillutsenko9306 2 жыл бұрын
Visual method is the best way to explain something
@creativeryu9682
@creativeryu9682 Жыл бұрын
Uhff Broooo, this is the best variable swapping tutorial I've every seen. I need to come up with this juicy visualization in my class. Never had so much fun by learning a new programming language.👍😎👌
@Atiqul_Akash
@Atiqul_Akash 11 ай бұрын
That Real Life Example was really helpful. Thanks
@rakhmatillomaribjonov5114
@rakhmatillomaribjonov5114 3 жыл бұрын
This is the great explanation I have ever seen👍👍👍 Good luck
@fabnsavvy
@fabnsavvy Жыл бұрын
I so needed this video for my quiz last night. I totally understand it so much better now, thank you!
@aryanmauryamr.perfect1426
@aryanmauryamr.perfect1426 Жыл бұрын
World's best teacher 🙃☺️☺️☺️☺️☺️ real life examples 😅🤘🤘
@marxmarx5058
@marxmarx5058 3 жыл бұрын
haven't seen a better teacher in my life
@ilcwm162
@ilcwm162 3 жыл бұрын
Your tutorials are soo fun to watch and easy to understand i dont understand why you are so underratedd!!
@mbilal11097
@mbilal11097 4 жыл бұрын
Really liked the kool-aid and water example. Love your vids keep up the good work bro.
@BroCodez
@BroCodez 4 жыл бұрын
thank you for watching Mohammad
@pallabganguly6525
@pallabganguly6525 2 жыл бұрын
The visual representation is too good man. 😀; Big Thumps up
@python360
@python360 4 жыл бұрын
$ python a, b = b, a You've been a great audience, goodnight!
@aryanmn1569
@aryanmn1569 3 жыл бұрын
that's why I love it and hate it at same time
@avinduvidusanka
@avinduvidusanka 8 ай бұрын
Real life example is awesome 🔥
@ihssanenedjaoui1444
@ihssanenedjaoui1444 7 ай бұрын
best explantion of the concept ever
@AP.3.
@AP.3. 2 жыл бұрын
public static void main(String[] args) { String x = "Lemon"; String y = "Water"; String temp = null; // extra string for switching manually temp =x; //pour x into null glass x = y; //pour y into x This helps us switch x and y y = temp; // pour temp into y System.out.println("a: "+y); //use println for printing 2 seperate sentences System.out.println("b: "+x);
@Vivekpandey-cy1ul
@Vivekpandey-cy1ul 3 жыл бұрын
I have not seen any better example like this before.
@Grindelfein
@Grindelfein 3 жыл бұрын
At first, I really needed to think about it, but I got it when I realized that the programm is executed line by line and that the variables therefore can be redefined depending on the (time)line the programm has progressed to (if that makes any sense). I think one can gets confused because in math, a variable is always fix (at least what I know from school math). I don´t have programming experience myself, I am just trying to find a language to start with by looking through some tutorials. Nice explaination!
@tazzythylacine7123
@tazzythylacine7123 2 жыл бұрын
Your content is pure gold :D
@aichalahnouki7594
@aichalahnouki7594 10 ай бұрын
4 years into computer science and this is the first time that I have ever understood how swapping works for real :)
@somebody.
@somebody. 2 жыл бұрын
I am seriously glad I found ur channel!!!
@ManVsBugs
@ManVsBugs Жыл бұрын
I appreciate the visual demonstration of the code!! good effort thank you
@claire_9219
@claire_9219 2 жыл бұрын
The explanation is so clear, thank you for your attentively.
@Shredfam
@Shredfam 5 ай бұрын
I think I understood the assignment. public class Main { public static void main(String[] args) { String x = "Burly"; String y = "Girly"; String temp; temp = y; y=x; x=temp; System.out.println("x: "+x); System.out.println("y: "+y); } } Learning Java next semester. Thanks for the vid.
@manashdebnath7168
@manashdebnath7168 Жыл бұрын
The best explanation in the globe.
@amarboparai4159
@amarboparai4159 Жыл бұрын
That live example was an overkill 😂
@annoyingprecision2487
@annoyingprecision2487 Жыл бұрын
Entertaining and mindblowing. Thank you.
@pavelkvasnicka6856
@pavelkvasnicka6856 Жыл бұрын
This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro
@flavialuyima
@flavialuyima 11 ай бұрын
i have to say i found this real life example very funny and also helpful
@SoyadRahman-g3v
@SoyadRahman-g3v 7 ай бұрын
Love from bangledesh bro you are doing good i saw your c++ vedio thats helped me a alot in the in my term;
@nhatnguyenquoc2004
@nhatnguyenquoc2004 Жыл бұрын
Thanks for your real life example with water :) It makes me understand more on this swapping method
@sk.faizanhussain281
@sk.faizanhussain281 2 ай бұрын
I never saw a video LIKE this❤❤❤
@darrenfrancis8126
@darrenfrancis8126 Жыл бұрын
something that helps me is writing comments describing whats happening when i set a variable equal to something. For example: temp = x; //temp is set to the value of x(water) x = y; //x is set to the value of y(kool-aid) y = temp; // y is set the value of temp(water) NOTE: remember temp was set to x which is the value of water
@Nabiile
@Nabiile 9 ай бұрын
bump
@alan-overthenet
@alan-overthenet Ай бұрын
Best explanation I have seen
@buddhimakaushalya2912
@buddhimakaushalya2912 2 жыл бұрын
that real life example is awsome brooo
@JustNeutral14.
@JustNeutral14. 3 ай бұрын
int x = 3; int y = 4; int temp = 0; temp = x; x = y; y = temp; temp = 0; System.out.println(x + ", " + y); Thanks for the tutorial!
@boringmangesh
@boringmangesh Жыл бұрын
One of the best course till date for JAVA!
@ericmovsessian4102
@ericmovsessian4102 3 жыл бұрын
Awesome bro, this is helping A LOT. Whish you all the best.
@Andboldquates
@Andboldquates Жыл бұрын
amazing, simple explanation, thanks bro
@Zoid-Berg
@Zoid-Berg Жыл бұрын
Best visually real life example
@sharonselah7607
@sharonselah7607 2 жыл бұрын
Love that presentation
@PaulLein-t9m
@PaulLein-t9m Жыл бұрын
Great visualization! I will be using that in my class.
@mohammedhero6933
@mohammedhero6933 3 жыл бұрын
This was a great explanation for how to swap between these variables 👍👍👍👍👍👍👍
@Dev-PauloEd
@Dev-PauloEd 2 жыл бұрын
Muito obrigado, mano, pelo vídeo. Certamente aprendi algo novo com isso
@AzizbekIunusov
@AzizbekIunusov 4 ай бұрын
public class Main{ public static void main(String[] args) { int x=14, y=415; int s; s=x; x=y; y=s; System.out.println(x); System.out.println(y); } } You are a great Teacher!!!!!
@shbenti2537
@shbenti2537 Жыл бұрын
Love the visualization
@adarshsharadpandey6723
@adarshsharadpandey6723 3 жыл бұрын
Became your fan brooooo 😍😍😍 Love from India ❤️❤️❤️❤️❤️
@maxbrown9977
@maxbrown9977 3 жыл бұрын
You are great can't express in words ❤
@Momo-iq6uu
@Momo-iq6uu Жыл бұрын
Best video I've ever seen. You're a genious.
@MorbidPasta
@MorbidPasta 2 жыл бұрын
idek why i'm watching a java video but the cups of water was hilarious
@redgey5163
@redgey5163 3 жыл бұрын
Thanks for the brilliant video. 2 people clearly drank the Koolaid....
@supersakib62
@supersakib62 2 жыл бұрын
What a visualisation!!
@stefan5450
@stefan5450 3 жыл бұрын
I tried to change between a glass of beer and a glass of whisky. Long story short: I messed up and drank both.
@AbdulAhad-nz5tp
@AbdulAhad-nz5tp 2 жыл бұрын
your example was very helpful.
How to accept user input in Java ⌨️【8 minutes】
8:02
Bro Code
Рет қаралды 200 М.
Call by Value & Call By Reference In C: C Tutorial In Hindi #31
27:30
CodeWithHarry
Рет қаралды 354 М.
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 2,2 МЛН
Worst flight ever
00:55
Adam W
Рет қаралды 31 МЛН
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 2,2 МЛН
Class 12 Structure in C 8 marks solution
16:01
Readers Nepal
Рет қаралды 81 М.
God-Tier Developer Roadmap
16:42
Fireship
Рет қаралды 7 МЛН
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 2,1 МЛН
Variables in Java ✘【12 minutes】
12:32
Bro Code
Рет қаралды 206 М.
Build this JS calculator in 15 minutes! 🖩
15:20
Bro Code
Рет қаралды 581 М.
COMPUTER SCIENCE explained in 17 Minutes
16:49
Wacky Science
Рет қаралды 1,2 МЛН
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 234 М.
Running "Hello World!" in 10 FORBIDDEN Programming Languages
18:07
Compiled Python is FAST
12:57
Doug Mercer
Рет қаралды 112 М.