I’ve been watching your videos to help in my programming 3 course and I feel like you simplify everything so well, I’ve really had a breakthrough in my understanding of certain concepts after watching your explanations. Thank you for your work!!
//************************************************* public class Main { public static void main(String[] args) {
// Encapsulation = attributes of a class will be hidden or private, // Can be accessed only through methods (getters & setters) // You should make attributes private if you don't have a reason to make them public/protected
I've probably watched a million hours of coding videos already and just stumbled upon this guy today and the way he simplifies and explain things is next level. Even better than WebDev Simplified, Coding with John or dCode.
1000000 hours = 114,155251 years. I wanted to say that this is not possible, but the oldest known living person is Maria Branyas of Spain, he aged 116 years, 189 days. The oldest known living man is Juan Vicente Pérez of Venezuela, aged 114 years, 105 days, so you must be Juan Vicente Pérez. This is unrealistic because he isnt alive anymore, The oldest living man is Edie Ceccarelli with 155 years and 216 days, your wrote the comment about 11 months ago, so it must be you Edie. Im really happy you still try to learn new things to this age. I do not only have too much time, but i wrote this comment also for the algorhytm to support Bro Code,
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
I never thought I would reach to the 40th tutorial video.....thanks a lot Bro😂😂🎉🎉🎉It has taken my dedication and your dedication to make me understand Java
Great explanation! It is super well structured and clear. I have to watch your videos while taking other Java course because you explain it so well! Thank you again!
Your videos are amazing! Thank you so much for teaching me Java. I was struggling hard with everything and OOP was not making any sense to me. You deserve so many more views! Keep up the good work!
thank you so much! I was quite confused with setters for a while, I thought they'd be useless if we already have constructors for initializing values but then you can just invoke the setters inside a constructor
Cause when we're talking about encapsulation, the whole idea is protect our code from other devs (ourself included). For example if i write an Account balance Atribute public in my program It's like i'm saying: "Anyone is free to change the value in here" but through the getters and setters. We limit the other at changing the atributes only in the object and only with the Getters and Setters. (Sorry if It's hard to understand i'm just learning OOP too) If someome see something wrong with my explaining feel free to correct me.
So the variables or class fields can't be modified directly, other reason is the setter methods allow us validate data before being assigned to variables and so on.
Because if suppose we create variable for rollnumber and make it private, by using setters we can set variable values depending on certain conditions and get value using getter but if we do not make that variable private we are giving access to other devs to enter any random value , not those values which are correct as per our condition so this is the use of setters if we create instance variables private and use setters to set value according to our condition then it will set.
Simple reason someone else can modify our variables...hence we declare it as private but if we give access to methods they will not be able to modify anything and hence our code is safe
I've just started to learn java and j discovered your channel and you are pretty good. So I wanted to support your channel with my comments. Thank you so much again for your amazing effort.
As a 2nd year and currently learning Java, I am so happy because I did not understand these concepts during the lecture but you simplified them. What a steal!
all we're really doing is making the attributes of our class private so that they cannot be directly accessed from elsewhere within our program if you need to retrieve one of these values you can use a getter method if you need to change or set one of these values you can use a setter method so that you can indirectly either get or set these values and other classes do not have direct access
Hi! Your videos are helping me excel in my Java class. Thank you so much! I have a question about setters. If I am using encapsulation but also using inheritance, how do I get around the fact that setting a variable in the parent class to private prevents a subclass from accessing/setting values for that private variable?
I guess I am just trying to understand the need for having constructors and setters to set values in the event I need to use both encapsulation and inheritance.
I have been thinking what is the point with encapsulation if you are returning the variable value anyway but watching your video I've realised that encapsulation is useful if you want to hide a variable value but you need that variable to calculated something. For example, you want to hide the percentage of revenue but you need it to calculate the final price of a product. You don't want that the percentageRevenue to be public.
I’ve been watching your videos to help in my programming 3 course and I feel like you simplify everything so well, I’ve really had a breakthrough in my understanding of certain concepts after watching your explanations. Thank you for your work!!
//*************************************************
public class Main {
public static void main(String[] args) {
// Encapsulation = attributes of a class will be hidden or private,
// Can be accessed only through methods (getters & setters)
// You should make attributes private if you don't have a reason to make them public/protected
Car car = new Car("Chevrolet","Camaro",2021);
car.setYear(2022);
System.out.println(car.getMake());
System.out.println(car.getModel());
System.out.println(car.getYear());
}
}
//*************************************************
public class Car {
private String make;
private String model;
private int year;
Car(String make,String model,int year){
this.setMake(make);
this.setModel(model);
this.setYear(year);
}
public String getMake() {
return this.make;
}
public String getModel() {
return this.model;
}
public int getYear() {
return this.year;
}
public void setMake(String make) {
this.make = make;
}
public void setModel(String model) {
this.model = model;
}
public void setYear(int year) {
this.year = year;
}
}
//*************************************************
U are a legend
Don't forget to pin this comment!! Thank you so much for all your help! Your videos are amazing and crystal clear!
just letting you know you forgot to bin this comment boss. thanks for everything
I've never felt more driven to like and comment on every video by any creator. Love your videos.
You are a legend. You make learning to code so much easier!!
I've probably watched a million hours of coding videos already and just stumbled upon this guy today and the way he simplifies and explain things is next level. Even better than WebDev Simplified, Coding with John or dCode.
humm who are they? im looking to get something from them too hahaha. lil bit of knowlwdge
1000000 hours = 114,155251 years. I wanted to say that this is not possible, but the oldest known living person is Maria Branyas of Spain, he aged 116 years, 189 days. The oldest known living man is Juan Vicente Pérez of Venezuela, aged 114 years, 105 days, so you must be Juan Vicente Pérez. This is unrealistic because he isnt alive anymore, The oldest living man is Edie Ceccarelli with 155 years and 216 days, your wrote the comment about 11 months ago, so it must be you Edie. Im really happy you still try to learn new things to this age. I do not only have too much time, but i wrote this comment also for the algorhytm to support Bro Code,
I found this great tutorial on Java Encapsulation. It really helped clear up my doubts.
Your explanation of setters and getters was amazing! Thank you so much
Man I really appreciate what you are doing. Keep going.
By far, the best You-Tube tutorial channel!
my teacher recommend you, very helpful
awesome! I'm thankful for the recommendation
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
Thanks, Bro. You're the best!
Shoutouts from Brasil.
I got know new technique of placing setter methods inside constructor. Thanks.
nice video for get and set method
Nice rhyme at the end, when you say ""hey you, yeah I'm talking to you...
I never thought I would reach to the 40th tutorial video.....thanks a lot Bro😂😂🎉🎉🎉It has taken my dedication and your dedication to make me understand Java
I loved the way you explain! Thanks a lot
great video!!! I'm infinitely grateful for your dedication and big heart to share this knowledge with the world. Thank you soo much
excellent demonstration, thank you so much
Great explanation, unlike other videos I have seen. I am understanding now the meaning of encapsulation. Thank you.
You are an uncrowned king
Thanks, Bro! ☕ You're awesome!
THis really helps me a lot! I am such lucky to find this video.
Thank you for reminding me to relax :) Actually sat back and relax for the first time in a while.. Dx
Great explanation! It is super well structured and clear. I have to watch your videos while taking other Java course because you explain it so well! Thank you again!
Your videos are amazing! Thank you so much for teaching me Java. I was struggling hard with everything and OOP was not making any sense to me. You deserve so many more views! Keep up the good work!
thank you so much! I was quite confused with setters for a while, I thought they'd be useless if we already have constructors for initializing values but then you can just invoke the setters inside a constructor
Happy teachers day/month bro
I consider you as my teacher because I learn a lot
Thanks
thank you Christian, I'm happy to help
what's the idea of making something private if you're just going to make setters and getters?
i think this too. Lol
Cause when we're talking about encapsulation, the whole idea is protect our code from other devs (ourself included). For example if i write an Account balance Atribute public in my program It's like i'm saying: "Anyone is free to change the value in here" but through the getters and setters. We limit the other at changing the atributes only in the object and only with the Getters and Setters. (Sorry if It's hard to understand i'm just learning OOP too) If someome see something wrong with my explaining feel free to correct me.
So the variables or class fields can't be modified directly, other reason is the setter methods allow us validate data before being assigned to variables and so on.
Because if suppose we create variable for rollnumber and make it private, by using setters we can set variable values depending on certain conditions and get value using getter but if we do not make that variable private we are giving access to other devs to enter any random value , not those values which are correct as per our condition so this is the use of setters if we create instance variables private and use setters to set value according to our condition then it will set.
Simple reason someone else can modify our variables...hence we declare it as private but if we give access to methods they will not be able to modify anything and hence our code is safe
Grat explanation, I salute you sir
Bro you are the fookinggggg best, you just helped me out for my assignment and seriously the best explaining everrrrr!!!!! thank you so much!!!❤
Bro you just saved me like you won't believe thanks.
Thank you so much! It took me actually quite long to understand this, but finally I understood this method!
I've just started to learn java and j discovered your channel and you are pretty good. So I wanted to support your channel with my comments. Thank you so much again for your amazing effort.
Oh boy, I finally understood encapsulation. phew!! Thanks Bro!
You may have 2.2 million subs, you are underrated anyways.
Simple and clear!
YOU ARE A LEGEND
Thank you so much for this! We really appreciate it bro!
Well Explanation, Thanks teacher for these Videos 🙏 you really helped me a lot ♥️
As a 2nd year and currently learning Java, I am so happy because I did not understand these concepts during the lecture but you simplified them. What a steal!
For it being your seconds year, What things about programming do you know so far?
Thank you for enlightening me with this knowledge :)
Bro,you're the best!
Clear and concise ! Thank you bro 🤜
this video is very helpfull
Yeah, another super video THAAAAAAANKS !
ur God at explaining!
Thanks, it is very inspiring and informative.
Legend bro..
great tutorials. thank you so much!!!
Best video
Bro had a party yesterday :D fistbump
all we're really doing is making the
attributes of our class
private so that they cannot be directly
accessed from elsewhere within our
program
if you need to retrieve one of these
values you can use a
getter method if you need to change or
set one of these values
you can use a setter method so that you
can indirectly either
get or set these values and other
classes do not have direct access
Hi! Your videos are helping me excel in my Java class. Thank you so much! I have a question about setters. If I am using encapsulation but also using inheritance, how do I get around the fact that setting a variable in the parent class to private prevents a subclass from accessing/setting values for that private variable?
I guess I am just trying to understand the need for having constructors and setters to set values in the event I need to use both encapsulation and inheritance.
use the super constructor! 🦸
ua-cam.com/video/oKZnHNM9Ew4/v-deo.html
@@BroCodez Ahhh okay got it. Thanks Bro!
I appreciate your effort Bro 💪💪💪
Comment for the algorithm, bro.
I have been thinking what is the point with encapsulation if you are returning the variable value anyway but watching your video I've realised that encapsulation is useful if you want to hide a variable value but you need that variable to calculated something. For example, you want to hide the percentage of revenue but you need it to calculate the final price of a product. You don't want that the percentageRevenue to be public.
Legend.
4:03 "Can we pretty please get" hhashadhashahahha
Thank you!
Thanks, bro! For real!
amazing
Thanks for watching!
King
nice
In the constructor,
What is different between using "this.setmake(make) " and not using "this."?
W for helping with comp sci final
Amazing
great
Also, great video!
@Bro Code hello bro what if we used a public class to string method to display everything?? its so simple right?
Bro Thank you very much!!
Thanks bro
Bro Code very good video, easy to understand. Hey bro can you paste down the code in the comment section
Thank you bro
best brooo
tysm.
dope
I never thought about replacing the parameters of the constructor with the Setters! :) What are the benefits of doing this?
Thanks a lot bro!
Good video Bro
Nice.
thank u bro
Da best
thank you brooooooooooo
thanks bro
Thanks, Bro!
understood bro.
Thank you so much sir.
Dropping a comment :)
thanks, this was really helpful
public String coding(){
return "encapsulation is so co0oll!"
}
thank u
thanks
niceuuu
thanku
Thanks
moreeee pleassseee
👍🏻👍🏻
thx
🎁 good vid