Java Tutorial: Access modifiers, getters & setters in Java
HTML-код
- Опубликовано: 14 окт 2020
- 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.com/videos/java...
►Ultimate Java CheatSheet: codewithharry.com/videos/java...
►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.codewithharry.com
►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
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
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?
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
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!!
Thank you so much for your amazing videos... It feels like Concept on OOPs is clear after watching these tutorials of urs.😊
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
Your teaching is a gift to this Generation !! thanks alot sir.
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
I was thinking of java when I got the notification xD yayyyy
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
Bro you made the learning so easy and fun......Keep the work up.
i really got this concept and loved the soundtrack at the end of the video.
Your teaching is making it too easy too learn thank you bro👍
Nice job dude!! Keep doing and keep going!! ❤️❤️
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🥺🥺🥺
thank you so much for provide this course.
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
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
You are rocking Harry bhai
Getter and setter are very important in Android development for example getText(),setImageResource() etc
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
Awesome 👍👍🎉🎉 video and knowledgable I was so confused about getter setter but now clear all doubt thnku bhai .... ❤️❤️❤️
Thanks sir for clearing our doubts ❤
yrr harry bhai thanku dil se java ke liye mujhe lg nhi rha tha itne aache se koi pdha sakta h opps conspt
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
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
This is one of the best course
harry bhai i love your video thnkyou for this free classes
This course is very good :)
Thanks harry for this video.
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
Superb haary bhai
Thank you very much harry bhai.
Thanks Harry Bhai For This Course ❤
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
Dear Harry, This video help me a lot, Thanks.
bhai your channel and websites is a GOLD MINE!!!!!!!!!!!
Keyboard noice is so satisfying man!!😍
Thank you sir!❤️
You are very hard working person
i am happy with this explanation
If i only i had met someone like you in my engg days, i would love programming :|
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
Thanks a lot sir 🔥 🔥 🔥 🔥
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
Thank you very much sir
Thanks Harry Bhaiya
Thank you ! Liked
Really great
U r doing really good job for us, bhagwan tumhe disha ptaani ki dilaye
Harry bhai aap bahut accha padhte ho hats off to you
Really amazing video
you're genius Harry Bhai 😊.
Tank u bhaiya for all this great lectures.. 🙂
Very helpful
Clearly understood Harry bayya
amaaazing mza aa gya
Next Roadmap Please Competitive Programing 🙏🙏🙏🙏🙏
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
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
Loving this Java cource sir 👍
Did you saw all of his videos and how good are you at coding now
awsm vdo bhaiya
Thanks for the nice video
Thank you Harry bhaiya
Op :) Playlist
Thank you harry bhai
U are a star harry bhai
Thank you so much brother I am Telugu, but I understand only Your classes, really great.
You deserve more than 1000 million subscribers
amazing lectures thank very much🤩🤩😍
Mazza aarha I'll see you next time❤️💡😘
Nice Java Tutorial
Amazing java course
Congratulations Harry bhai 3million done and more to come ❤️🥳
thank you!!!!!
waaahh harry bro after so long java oops smjh aya
very fruitful video. i have one request that plz make videos on .net development. i really like your teaching way.. ty sir.. tysm
Thankyou 😘😃
behtreen yar
Helpfull video
Seriously thank you
Bhaijaan ❤️ tussi great ho
Thank you Harry bhai i got my hacktober fest t-shirt ❤️😍
Thank you bhaii 🤩👍
amazing sir you are the best thank you so much sir
Nice Man
thank you sir
Sir I got 2020 Hacktober Fest T-Shirt..A Huge Thanks for introducing it to commoners.
Thank You
Abhi programming me maja aaya na bhidu !!!!! ye dukh finally khatam ho gaya ;)
Oh Yeah!
👍too good sir
thanks harry sir
THANK YOU 🤩🤩
Thank You Sir
good ex. on object oriented programming broo
I am greatful to you
Nice lecture
your are best