Switch Case in Java #35

Описание к видео Switch Case in Java #35

$1,000 OFF ANY Springboard Tech Bootcamps with my code ALEXLEE. See if you qualify for the JOB GUARANTEE! 👉 https://bit.ly/3HX970h

This is how you can use switch case statements in your java programs! ✅Hopefully, what I've taught you will help you with these tricky switch statements.


👑Start practicing now with 10 free java programs - http://alexlorenlee.com/
🌅Source Code - https://github.com/alexlorenlee/JavaT...

If you have if/else if statements comparing one variable over and over, a switch case statement may be easier for you. The layout for a java switch case statement looks like this:

switch(num) {
case 1:
//do this
break;
case 2:
//do this
break;
default:
//do this
}

Switch cases can be better in many situations, but if your code works with if else statements instead, I wouldn't worry about it too much.

This switch statement in java can be tricky at first... But SURELY you'll get it :) If you followed along, congrats! You learned-by-doing!

I hope you enjoyed this tutorial on how to use switch case in java! I like to have a nice mix of java tutorials and actual projects for you all :)

Do you want to learn how to write java code from scratch, in Java? Check out my Java Tutorial For Beginners:    • Coding For Beginners In Python  

Was this able to get your switch case statement working? -

Full Java Tutorial For Beginners Playlist:    • Full Java Course by Alex Lee  
Free Tips: https://bit.ly/3U6HXcb

Disclosure: The Springboard link provided is linked to my affiliate account & supports the channel.

~

Alex Lee

Комментарии

Информация по комментариям в разработке