Access Modifiers Java Tutorial #82

preview_player
Показать описание

The access modifiers Java has are default, public, private and protected. These let you say which files can see methods and variables. ✅Hopefully, this java access modifiers tutorial taught you will help you fix your null pointer exception.

Java access modifiers 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 access modifiers java tutorial! I like to have a nice mix of tutorials and actual projects for you all :)

Was this able to help you learn about default, public, private and protected in java? -

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

~

Alex Lee
Рекомендации по теме
Комментарии
Автор

Summary:
1. private: accessible in the same file
2. default: accessible in the same package
3. protected: accessible in the same package; accessible in all packages w/ "extend" E.g. otherpackage extend package1{
4. public: accessible in all packages

haaaaadsfggh
Автор

Hey, I live in Mexico and I'm self-studying Java for computer science AP. I just wanted to let you know that even though you have a small channel, you already have international viewers. Vary the channel content a little, post a bit more often, and I'm sure you'll gain a bigger following. You have quality videos and lots of potential. Keep up the good work! :)

romanparra
Автор

You helped me with my programming exam last semester. Thank you.

LeGrandeux
Автор

Your way of teaching is just exceptional

rajkush
Автор

Public variables/methods can be accessed from any class or package.


Default variables/methods can only be accessed from within the same class or within the same package - a default variable/method cannot be accessed from a class in a different package.

ziyaadmoosa
Автор

Alex, I watched a lot of videos on Java. Frankly speaking, you are doing a great job. Thank you for your time and your praise-worthy efforts! Kind Regards.

Abyasun
Автор

I've already watched people from my country for this topic. But I didn't understand them as much as you. Thank you so much, you helped me a lot. :)

diclebahceli
Автор

Just wanna let you know that your vids help me out the most when learning java. Thanks!!!

bnug
Автор

it seems like every time i have a question, you show up with the answer. Count me subscribed!

AdamAdam-lepm
Автор

I just wanted to thank you for your videos, but honestly...thank you. Words can barely describe how much it helped me starting to learn programming. Your videos are so easy to understand and its short and timesaving. If i learned everything from books, it would have taken me tens or hundreds of hours more!

serafall
Автор

"So the only difference between default and public is that public you write it in front" - that's not correct. Default fields are only visible to classes in the same package while Public fields are visible to any other class

If you leave the access modifier for hours and minutes as 'default' in the class 'Access1', you won't be able to access those fields in the class 'Access3', which is in another package.

sandeeppandey
Автор

Thank you for posting this tutorial! I watched other videos of people trying to explain it and it made 0 sense. You really broke it down simplistically. I appreciate it!

sararogers
Автор

Thanks a lot Alex, for everyone the short-cut of System.out.println is type sysout + hit buttons ctrl+space.

abdeselamselami
Автор

This is the most clear explanation that I saw till date. Thank you very much Alex.

sachinjaveri
Автор

Amazing youngest teacher, Amazing personality. I appreciate it bro. Respect you a lot from Azerbaijan.

anaralizada
Автор

love how simply you convey the concepts and often giving real life examples. I know programming concepts can be implemented to any languages, but would love to see some videos with C as well. thanks for the videos man, helped me a lot. all the best, stay safe, stay healthy and happy.

SazidShan
Автор

this video was sent by my teacher in our google classroom and I think this is great.

vensenpai
Автор

You are the best Java tutor who put the idea of Java is not at all hard to learn❤❤

rajtonystark
Автор

U made the video in a very simple way to understand. Thanks a lot

sathya
Автор

You are life saver! my lecturer just gave us the coding and asked us to run the coding to understand on our own :O

sitinorfarhana