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
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!
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!
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.
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'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,
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
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!
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 don't really understand what the point of using this is.. maybe to set a variable that can't be manually changed? but what about the setter method then?
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
Good video Bro but I have a question. Is it really necessary to write "this" in the constructor? It works fine without it, so is it just good practice to write it like that?
I have a doubt from a long time and couldnt find the answer.......We use access modifiers to control the accessiblity within the program to ensure encapsulation.....so if we have a private variable and if still we can access it through a public getter method then what is the use of having a private variable.....it can be public instead right?
As far as I understand, It's mostly used to prevent potential misuse and unintended modifications. Suppose the data member year was public. And somewhere in the code we use car.year = -1990 which is not valid. What benefits would be there with setters now would be that we can enforce further validations on setter method so that scenarios such as this doesn't ruin data integrity. We can put an if check inside setter method to throw an exception whenever year is passed negative, thus providing us with an controlled way to modify the internal state of an object.
How come you didn’t have to refer the class variables make, model, and year as this.make, this.model, and this.year throughout their class when referring to them? I though only if they were static they could do that. You only did so for the constructor, so I’m confused why it only applies there and not anywhere else.
you can do either. I forgot to add "this." for the getters. I probably should have kept it consistent If it was static it would be the name of the class Car.make for example
plz someone tell me what i have to do to write setters and getters of attributes in one click i mean just by simple clicking without writing every single word i need a solution
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!!
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!
Your explanation of setters and getters was amazing! Thank you so much
Man I really appreciate what you are doing. Keep going.
I loved the way you explain! Thanks a lot
By far, the best You-Tube tutorial channel!
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!
Thanks, Bro. You're the best!
Shoutouts from Brasil.
Thank you so much for this! We really appreciate it bro!
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.
Bro you are the fookinggggg best, you just helped me out for my assignment and seriously the best explaining everrrrr!!!!! thank you so much!!!❤
Great explanation, unlike other videos I have seen. I am understanding now the meaning of encapsulation. Thank you.
THis really helps me a lot! I am such lucky to find this video.
great tutorials. thank you so much!!!
Thanks, Bro! ☕ You're awesome!
Thank you for enlightening me with this knowledge :)
Bro,you're the best!
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'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,
Well Explanation, Thanks teacher for these Videos 🙏 you really helped me a lot ♥️
Thank you for reminding me to relax :) Actually sat back and relax for the first time in a while.. Dx
Nice rhyme at the end, when you say ""hey you, yeah I'm talking to you...
Clear and concise ! Thank you bro 🤜
Bro you just saved me like you won't believe thanks.
I got know new technique of placing setter methods inside constructor. Thanks.
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
You are an uncrowned king
Yeah, another super video THAAAAAAANKS !
Thanks, it is very inspiring and informative.
Thank you!
Grat explanation, I salute you sir
Oh boy, I finally understood encapsulation. phew!! Thanks Bro!
In the constructor,
What is different between using "this.setmake(make) " and not using "this."?
thanks, this was really helpful
Thanks, bro! For real!
I appreciate your effort Bro 💪💪💪
Thanks a lot bro!
Legend bro..
Bro Thank you very much!!
amazing
this video is very helpfull
my teacher recommend you, very helpful
awesome! I'm thankful for the recommendation
Legend.
Thanks, Bro!
ur God at explaining!
King
Thank you so much sir.
Thanks !!
I never thought about replacing the parameters of the constructor with the Setters! :) What are the benefits of doing this?
Amazing
Good video Bro
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?
Best video
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
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! 🦸
ruclips.net/video/oKZnHNM9Ew4/видео.html
@@BroCodez Ahhh okay got it. Thanks Bro!
thanks bro
best brooo
dope
Also, great video!
Thank you bro
tysm.
thank u bro
Nice.
!good!
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.
Da best
seen in a problem set : "use the selector method to display the results".
What is the selector method?
After we do the set method. Why do we need to write this.setMake(make) at the top again?
thanks
thank you brooooooooooo
Bro Code very good video, easy to understand. Hey bro can you paste down the code in the comment section
Thanks bro
thank u
great
Thanks
thx
I don't really understand what the point of using this is.. maybe to set a variable that can't be manually changed? but what about the setter method then?
4:03 "Can we pretty please get" hhashadhashahahha
understood bro.
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
Bro had a party yesterday :D fistbump
thanku
Good video Bro but I have a question. Is it really necessary to write "this" in the constructor? It works fine without it, so is it just good practice to write it like that?
I thought it might help clarify for teaching purposes
W for helping with comp sci final
Dropping a comment :)
moreeee pleassseee
Comment for the algorithm, bro.
niceuuu
👍🏻👍🏻
I have a doubt from a long time and couldnt find the answer.......We use access modifiers to control the accessiblity within the program to ensure encapsulation.....so if we have a private variable and if still we can access it through a public getter method then what is the use of having a private variable.....it can be public instead right?
As far as I understand, It's mostly used to prevent potential misuse and unintended modifications. Suppose the data member year was public. And somewhere in the code we use car.year = -1990 which is not valid. What benefits would be there with setters now would be that we can enforce further validations on setter method so that scenarios such as this doesn't ruin data integrity. We can put an if check inside setter method to throw an exception whenever year is passed negative, thus providing us with an controlled way to modify the internal state of an object.
🎁 good vid
Why do you "return make" and not "return this.make" in the getter method?
💪👍
Hloo bro , i watched the oop playlist but now how can i practice my oop concepts can u plz suggest some practice problems.. thanks
How come you didn’t have to refer the class variables make, model, and year as this.make, this.model, and this.year throughout their class when referring to them? I though only if they were static they could do that. You only did so for the constructor, so I’m confused why it only applies there and not anywhere else.
you can do either. I forgot to add "this." for the getters. I probably should have kept it consistent
If it was static it would be the name of the class Car.make for example
@@BroCodez thanks
plz someone tell me what i have to do to write setters and getters of attributes in one click i mean just by simple clicking without writing every single word i need a solution