Java Tutorial: Access modifiers, getters & setters in Java
ฝัง
- เผยแพร่เมื่อ 22 ต.ค. 2024
- Java access modifiers: In this video, we will see how to use access modifiers in Java. Java offers public, default, private and protected access modifiers. We will also see how to use getters and setters!
►This playlist is a part of my Complete Java Course playlist: • Java Tutorials For Beg...
►Source Code + Notes - codewithharry....
►Ultimate Java CheatSheet: codewithharry....
►Checkout my English channel here: / programmingwithharry
►Click here to subscribe - / @codewithharry
Best Hindi Videos For Learning Programming:
►Learn Python In One Video - • Python Tutorial In Hin...
►Python Complete Course In Hindi - • Python Tutorials For A...
►C Language Complete Course In Hindi -
• C Language Tutorials I...
►JavaScript Complete Course In Hindi -
• JavaScript Tutorials I...
►Learn JavaScript in One Video - • JavaScript Tutorial
►Learn PHP In One Video - • Learn Php In One Video...
►Django Complete Course In Hindi -
• Python Django Tutorial...
►Machine Learning Using Python - • Machine Learning Tutor...
►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
►Advanced Python Tutorials - • Intermediate/Advanced ...
►Object Oriented Programming In Python - • Object Oriented Progra...
►Python Data Science and Big Data Tutorials - • Python Data Science an...
Follow Me On Social Media
►Website (created using Flask) - www.codewithhar...
►Facebook - / codewithharry
►Instagram - / codewithharry
►Personal Facebook A/c - / geekyharis
Twitter - / haris_is_here
You're are really a great teacher. Most of the courses are expensive to learn which many people couldn't afford, but you're the only one man army who can teach us almost everything. Keep it up, keep doing this great work. God bless you.
If You want to learn free Coding then download MX Coding Hub - Coding Made Easy from google play store and get free certificate. It's amazing and 100% free.
Same views
Your contribution is just wow.
It is a evolution of coding in India
You making the future of 🇮🇳🇮🇳🇮🇳🇮🇳 better I am sure you are rewarded as BHARAT RATNA in future
@@technicalsahilabbasi2171 thanks
😂😂😂😂😂😂What a joke
@@vkraj8735 joke nhi yr itne acche say explain krte hai harry sir agar inka jaise college ke teacher ho jaye too subko coding easy lagege ❤️🙏
Not only India also other country people who knows Hindi and multi languages🙂🙂
You should definitely not joke on people like these as they are damn rare🥺🥺🥺
Harry bhai I cant thank you enough. I am doing courses for Java fullstacks. Today they taught us the topic for 3 hours and I couldnt figure out why we use this thing. My professor replied to me that its used to access private variables. Bhai apne itna ache se explain kiya k why exactly we need to use it. We need teachers like you. I have learnt so much from you and I cant thank you enough. I cant even pay you back. I always like your video first before watching it. You are Great Brother.
Did you saw all of his videos and how good are you at coding now?
Dear Harry sometimes i thing u are out of this world 'cause u made my learning so easy that even my school teachers can't .
Did you saw all of his videos and how good are you at coding now
Sir really nice timing and I was sitting ideal and thinking about java and got the notification
If You want to learn free Coding then download MX Coding Hub - Coding Made Easy from google play store and get free certificate. It's amazing and 100% free.
Did you saw all of his videos and how good are you at coding now
and you@@sanafatima1759
Hi Harry,
My name is V.Nandini. A Huge Fan of you from Telangana. I had started learning java from many sites and other youtube videos, but not at all satisfied and I had stopped learning them in between. To speak honestly, your channel and you are brilliant. It had solved many of my doubts. I had became efficient after doin many of your exercises, practise sets and following your notes mainly. I had accessed your entire java playlist too. Thankyou very much Harry!!!!
Answer ::::::::
class Circle{
private int radius;
public int getRadius(){
return radius;
}
public int setRadius(int r){
return radius=r;
}
public float area(){
return 3.14f*(radius*radius);
}
}
public class Main{
public static void main(String[] args) {
Circle cr = new Circle();
cr.setRadius(5);
System.out.println(cr.getRadius());
System.out.println(cr.area());
}
}
sorry to say this Nandini, but while setting the radius you don't have to use int, instead you should've used void..
ex: public void setRadius(int r){
radius = r;
}
public int getRadius(){
return radius;
}
Ps - Please correct me if I'm wrong
Wrong hai bhai
Tune method me condition nahi Diya hai check kerne ke liye
Aur pubic void setradius hota hai
Setter returns type nahi hai
Your teaching is a gift to this Generation !! thanks alot sir.
Bhai aap brilliant work kar rahe ho ,audience harry bhai itna hard work kar rahe hain ,plz yaar inko support karo❤️❤️🙏🙏.Bhai maine aapka sabse pahle 2:30 hours wala course complete kar liya ab iska baari hai. Love u bhai from jharkhand,har koi online paise lete hain koi v language sikhane k liye aur aap poor k liye sab kuch free kar diye ho wooo
i really got this concept and loved the soundtrack at the end of the video.
Thank you so much for your amazing videos... It feels like Concept on OOPs is clear after watching these tutorials of urs.😊
Harry bhai u literally deservs bharat ratn.... u teach us from 'our' perspective of seeing at logic and code n thats really rare. M really thankful to u for creating such important stuffs.
Bdw Elon Musk ka joke wad really funny that keeps us engaged and entertained throughout 👍👍👍👍
Did you saw all of his videos and how good are you at coding now
Man, this Guy really needs a big hand. He is just giving his best to make us learn coding.
If You want to learn free Coding then download MX Coding Hub - Coding Made Easy from google play store and get free certificate. It's amazing and 100% free.
Did you saw all of his videos and how good are you at coding now
Thanks a lot of this free tutorials 😊🌼 My God Bless U Harry Bhaii...
Did you saw all of his videos and how good are you at coding now
bhai your channel and websites is a GOLD MINE!!!!!!!!!!!
class Circle {
private int radius;
private float area;
private float perimeter;
public void setradius(int r){
radius = r;
}
public void checkarea(float a){
area=3.14f*radius*radius;
if(area==a)
{
System.out.println("Correct Area.");
}
else{
System.out.println("Incorrect Area.");
}
}
public void checkperimeter(float p){
perimeter = 2*3.14f*radius;
if(perimeter==p)
{
System.out.println("Correct Perimeter.");
}
else{
System.out.println("Incorrect Perimeter.");
}
}
}
public class roughjava{
public static void main(String[] args){
Circle ci= new Circle();
ci.setradius(3);
ci.checkarea(28.26f);
ci.checkperimeter(18.84f);
}
}
clean code💗
Bro Why you Have Done area==a and perimeter==p could you please explain
@@sarthaktripathi7441 ya check kara ga ka user na float datatype ke value he put ke ha ya kuch or
@@Fatima-x1h3y nhi ... Ye check karega original area aur user ne jo area set kia hai right hai ki nahi
@@SyedUzair_5 yeah right
yrr harry bhai thanku dil se java ke liye mujhe lg nhi rha tha itne aache se koi pdha sakta h opps conspt
Finally!!
End of 40th video!!
Couldn't finish it last night but at now the milestone is passed!!
Tomorrow shall be for 50th!!
Jai Hind!!
Jai Jagannath!!
Jay jagannath ❤
@@RahulprasadDas Jai jagannath 🙏
I was thinking of java when I got the notification xD yayyyy
You are a greate teacher ........your all video are so intrusting and meaningfull.....keep it up 👍👍
Did you saw all of his videos and how good are you at coding now
You are rocking Harry bhai
Thank you so much brother I am Telugu, but I understand only Your classes, really great.
You are doing absolutely Fantastic work. How to prepare yourself for exams?
Your teaching is making it too easy too learn thank you bro👍
Sir u are the only good thing happening to me this year
Did you saw all of his videos and how good are you at coding now
Thanks Harry Bhai For This Course ❤
You deserve more than 1000 million subscribers
U r doing really good job for us, bhagwan tumhe disha ptaani ki dilaye
Getter and setter are very important in Android development for example getText(),setImageResource() etc
Harry bhai aap bahut accha padhte ho hats off to you
East or west code with harry is the best.
Love u so much sir 😘😘
Thank you for your best playlist which we get in free 😘😘 love u so much thank ×10000 times . loop 😂😂 mey chala dijye thank you ko
Keyboard noice is so satisfying man!!😍
i am happy with this explanation
Dear Harry, This video help me a lot, Thanks.
You are doing great work sir ❤
Bro you made the learning so easy and fun......Keep the work up.
Awesome 👍👍🎉🎉 video and knowledgable I was so confused about getter setter but now clear all doubt thnku bhai .... ❤️❤️❤️
This is one of the best course
Tank u bhaiya for all this great lectures.. 🙂
Sir you are the best coding youtuber in the world 🔥🔥
Did you saw all of his videos and how good are you at coding now
You are great coder in the world. Thank you sir.
Did you saw all of his videos and how good are you at coding now
Thank you very much harry bhai.
Congratulations Harry bhai 3million done and more to come ❤️🥳
you're genius Harry Bhai 😊.
Springboot tk course le jaana bro plzzzz👉👉🔥🔥🔥🔥❤️❤️ haath jod rha hun....Plzzz springboot tk.....Full stack java ...Kyunki mere jaise bahut se log honge jo 40000 ya 50000 paisa ni laa payenge plzzzzz 🙄🙄🔥 kaash ye sach ho jaye ki harry bhai Springboot tk sikha de....Plzzz support kro....Please❤️❤️❤️❤️❤️❤️
If You want to learn free Coding then download MX Coding Hub - Coding Made Easy from google play store and get free certificate. It's amazing and 100% free.
I totally agreee with u
good ex. on object oriented programming broo
Thanks harry for this video.
10:42 - Checking Area and Circumference of a Circle using getters and setters
class Circle{
private float radius,area,circumference;
void setRadius(float r){
radius = r;
}
void setArea(float a){
if (a==22*radius*radius/7)
area = a;
else
System.out.println("WARNING : Wrong area as per the radius.");
}
void setCircumference(float c){
if (c==2*22*radius/7)
circumference=c;
else
System.out.println("WARNING : Wrong circumference as per the radius.");
}
float getRadius(){
return radius;
}
float getArea(){
return area;
}
float getCircumference(){
return circumference;
}
}
public class Checking_Circumference_and_Area_Of_Circle {
public static void main(String[] args) {
Circle cr = new Circle();
cr.setRadius(9.0f);
cr.setArea(254.571428571429f);
cr.setCircumference(56.5714285714286f);
System.out.println("Area : "+cr.getArea()+" sq. cm");
System.out.println("Circumference : "+cr.getCircumference()+" cm");
}
}
Thanks
Thanks 👍
bdiya jio jio
Why are you use float and make code complicate. Simple use int enter radius and cut the remaning point value :)...
@@manjit0000 brother using float is usually a safer option alwayss
You are very hard working person
amazing lectures thank very much🤩🤩😍
Thanks sir for clearing our doubts ❤
HAPPY TEACHER'S DAY ❤ HARRY BHAIYA...learned a lot from you..🧡🤍💚
Next Roadmap Please Competitive Programing 🙏🙏🙏🙏🙏
U are a star harry bhai
harry bhai i love your video thnkyou for this free classes
Mazza aarha I'll see you next time❤️💡😘
Thank you very much harry bhaiya🙏 u are helping everyone soo much🙏thanks for educating millions for free!! Seriously may God bless you bhai🙏🙇♂️
Did you saw all of his videos and how good are you at coding now
I don't know how many times i will comment but you are a legend🥺🥺🥺❤️❤️. You are changing life of many and if I will be one, i will pay all the debts from depth of my heart🥺
Such a nice comment bro.
you are paying by watching his videos
Nice job dude!! Keep doing and keep going!! ❤️❤️
If i only i had met someone like you in my engg days, i would love programming :|
Clearly understood Harry bayya
Abhi programming me maja aaya na bhidu !!!!! ye dukh finally khatam ho gaya ;)
Oh Yeah!
thank you so much for provide this course.
Thanks Harry Bhaiya
Can you make a short video on how to apply input validations? Like accepting only int or char etc etc in any language... It will be very helpful. Thank you
3:18
getter setter method Thanks
Superb haary bhai
amazing sir you are the best thank you so much sir
Thank you for the full java course.
Did you saw all of his videos and how good are you at coding now
@@sanafatima1759 nope,
But this lesson guided me in good way...
@@soumyadipmajumder3450 you are still learning?
@@sanafatima1759 Yup buddy
waaahh harry bro after so long java oops smjh aya
Loving this Java cource sir 👍
Did you saw all of his videos and how good are you at coding now
very fruitful video. i have one request that plz make videos on .net development. i really like your teaching way.. ty sir.. tysm
Nice Java Tutorial
Thank you sir!❤️
Bhai i got a t shirt through the hacktober fest which u suggested in a video
Thanks
Sir jb bhi m koi book padhta hu usme naming conventions pr boht dhyaan diya jaata h aur samajhne me aasani hoti h isiliye aap bhi naming vagera thodi topic se related rha kro.
Like at 4:10 line 7 me aapne parameter me "String n" name rkha h jo ki topic se bilkul bhi related nhi h toh thoda names pr bhi dhyan diya kro🙏
It's just a suggestion to improve your content 😄.
Amazing java course
Sir I got 2020 Hacktober Fest T-Shirt..A Huge Thanks for introducing it to commoners.
Harry bhai last ma pura notes mila kar dadana ... Love from kashmir
Bhaijaan ❤️ tussi great ho
This course is very good :)
Sir, your this java course WITH NOTES is really very helpful but I have a question that will this course help us in android app development
REPLY SOON
Harry Bhai,
Please come live on TH-cam for us.
Thanks a lot sir
We want a Qna session
Plz make something for BCA students also ...
About how they want to start learning some other languages..
Did you saw all of his videos and how good are you at coding now
@@sanafatima1759 i have seen 4-5 videos but not for learning just to know his teaching style nd all.
Now I know dsa with java, html, css, js, react, node, now learning mongo and express not from him but from other sources :(
He is also a very good teacher but I'm not able to get his teaching so I stopped watching him. 👍
@@manishprajapati8328 great! Thank you
T shirt order kar di hackertober fest wali💚💚💚❤️💚❤️💚❤️💚❤️😆😁😄😀😄
Love u Harry bhai💚❤️❤️
Dhanyavaad Harry Sir!!!!
Please Give A ShotOut Please :-}
Sir please react js par tutorial banao
Hello Harry bhaiya please make another video on Call by value and call by reference in c language
Thank You Sir
finally understand concept after watching it 4rt time \3
Could you plss explain me??
Thank you Harry bhai i got my hacktober fest t-shirt ❤️😍
Sir i got my t-shirt of hacktoberfest sir thanks alot :)
When??
@@shaikzubayr9327 I had cofirmed the order for the tshirt and it will come after 6-12 weeks as mentioned at hacktoberfest site :)
Ok
Sir can we assume a QNA at 1 million.
Awesome Leatures
your videos are so damn helpful !! THANK YOU SO MUCH for these :))))
Did you saw all of his videos and how good are you at coding now
10:42
class circle1{
private int rad;
public int getRad(){
return rad;
}
public void setRad(int i){
this.rad=i;
}
public float area(){
return (3.14f*rad*rad);
}
}
Please make the whole java tutorial in one video.
Harry bhai explain socket module in python