Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

Java Scope – Scope of Variables in Java Tutorial #53

26K views on YouTube

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

Welcome to this Java scope tutorial! To find the scope of variables in java, you look at the curly braces the variable is directly in. If it’s in the same curly braces, after the variable is created, it’s in the scope!

Learn java in just 13 minutes: https://youtu.be/RRubcjpTkks

The scope of a variable in java is whatever is inside it’s curly braces. For example:

if(true) {
int a = 0;
}

The scope of a is everywhere in the curly braces. Outside of the curly braces, a doesn’t exist.

Variable scope 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 java scope tutorial! I like to have a nice mix of java tutorials and actual projects for you all 🙂

Was this able to help you learn the scope of variables in java?

Full Java Tutorial For Beginners Playlist: https://youtube.com/playlist?list=PL59LTecnGM1NRUyune3SxzZlYpZezK-oQ&si=6OSbyiJxFsTjqL_9
Free Tips: https://bit.ly/3U6HXcb

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

Alex Lee