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

Комментарии • 559

  • @noone.4981
    @noone.4981 3 года назад +134

    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.

    • @ashmitakour8262
      @ashmitakour8262 3 года назад +2

      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.

    • @vinitasharma8170
      @vinitasharma8170 3 года назад +3

      Same views

  • @NoobCoder623
    @NoobCoder623 2 года назад +10

    Your contribution is just wow.
    It is a evolution of coding in India

  • @DileepKumar-ec6sq
    @DileepKumar-ec6sq 3 года назад +10

    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 .

    • @sanafatima1759
      @sanafatima1759 2 года назад +1

      Did you saw all of his videos and how good are you at coding now

  • @kartikparmar9959
    @kartikparmar9959 3 года назад +8

    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.

    • @sanafatima1759
      @sanafatima1759 2 года назад

      Did you saw all of his videos and how good are you at coding now?

  • @ritikchaudhary1984
    @ritikchaudhary1984 2 года назад +36

    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);
    }
    }

  • @biswajeet9826
    @biswajeet9826 16 дней назад +2

    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!!

  • @DelicaciousTales
    @DelicaciousTales 2 года назад +13

    Thank you so much for your amazing videos... It feels like Concept on OOPs is clear after watching these tutorials of urs.😊

  • @09.arkodevmukherjee24
    @09.arkodevmukherjee24 3 года назад +23

    Sir really nice timing and I was sitting ideal and thinking about java and got the notification

    • @ashmitakour8262
      @ashmitakour8262 3 года назад

      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.

    • @sanafatima1759
      @sanafatima1759 2 года назад +1

      Did you saw all of his videos and how good are you at coding now

    • @user-bc7jo9ye1v
      @user-bc7jo9ye1v 29 дней назад

      and you​@@sanafatima1759

  • @socialogic725
    @socialogic725 3 года назад +9

    Your teaching is a gift to this Generation !! thanks alot sir.

  • @nandinivangaveti737
    @nandinivangaveti737 2 года назад +27

    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());
    }
    }

    • @mayureshlavangare116
      @mayureshlavangare116 11 месяцев назад +4

      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

    • @delete7950
      @delete7950 8 месяцев назад

      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

  • @RohanDasRD
    @RohanDasRD 3 года назад +7

    I was thinking of java when I got the notification xD yayyyy

  • @sadashish2002
    @sadashish2002 3 года назад +3

    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

  • @shouryarajput5633
    @shouryarajput5633 3 года назад +1

    Bro you made the learning so easy and fun......Keep the work up.

  • @manalikarankal6570
    @manalikarankal6570 2 года назад +3

    i really got this concept and loved the soundtrack at the end of the video.

  • @LalitKumar-ts5tq
    @LalitKumar-ts5tq 3 года назад +2

    Your teaching is making it too easy too learn thank you bro👍

  • @AnkitSingh-wc8gz
    @AnkitSingh-wc8gz 3 года назад +2

    Nice job dude!! Keep doing and keep going!! ❤️❤️

  • @privicyismyth9958
    @privicyismyth9958 3 года назад +432

    You making the future of 🇮🇳🇮🇳🇮🇳🇮🇳 better I am sure you are rewarded as BHARAT RATNA in future

    • @privicyismyth9958
      @privicyismyth9958 3 года назад +4

      @@technicalsahilabbasi2171 thanks

    • @vkraj8735
      @vkraj8735 3 года назад +18

      😂😂😂😂😂😂What a joke

    • @ayushmishra6915
      @ayushmishra6915 3 года назад +15

      @@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 ❤️🙏

    • @icebear3627
      @icebear3627 3 года назад +3

      Not only India also other country people who knows Hindi and multi languages🙂🙂

    • @shivampanjiyara8288
      @shivampanjiyara8288 3 года назад +6

      You should definitely not joke on people like these as they are damn rare🥺🥺🥺

  • @rajvlogs7688
    @rajvlogs7688 Год назад +1

    thank you so much for provide this course.

  • @humaali4636
    @humaali4636 3 года назад +5

    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 👍👍👍👍

    • @sanafatima1759
      @sanafatima1759 2 года назад

      Did you saw all of his videos and how good are you at coding now

  • @bholekdiwanee5669
    @bholekdiwanee5669 3 года назад +10

    Thanks a lot of this free tutorials 😊🌼 My God Bless U Harry Bhaii...

    • @sanafatima1759
      @sanafatima1759 2 года назад

      Did you saw all of his videos and how good are you at coding now

  • @akshit288
    @akshit288 3 года назад +5

    You are rocking Harry bhai

  • @reloadingbrains5460
    @reloadingbrains5460 3 года назад +13

    Getter and setter are very important in Android development for example getText(),setImageResource() etc

  • @binodofficial8420
    @binodofficial8420 3 года назад +1

    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

  • @saurabhverma5460
    @saurabhverma5460 2 года назад

    Awesome 👍👍🎉🎉 video and knowledgable I was so confused about getter setter but now clear all doubt thnku bhai .... ❤️❤️❤️

  • @virendramali1754
    @virendramali1754 Год назад

    Thanks sir for clearing our doubts ❤

  • @mohdkamran1861
    @mohdkamran1861 2 года назад

    yrr harry bhai thanku dil se java ke liye mujhe lg nhi rha tha itne aache se koi pdha sakta h opps conspt

  • @buddhadebbairagi2022
    @buddhadebbairagi2022 3 года назад +4

    Man, this Guy really needs a big hand. He is just giving his best to make us learn coding.

    • @ashmitakour8262
      @ashmitakour8262 3 года назад

      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.

    • @sanafatima1759
      @sanafatima1759 2 года назад

      Did you saw all of his videos and how good are you at coding now

  • @himankjeshwar8636
    @himankjeshwar8636 2 года назад +106

    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");
    }
    }

  • @chandrakanth8495
    @chandrakanth8495 2 года назад +1

    This is one of the best course

  • @gouravgupta5799
    @gouravgupta5799 3 года назад

    harry bhai i love your video thnkyou for this free classes

  • @saiyamarora3788
    @saiyamarora3788 3 года назад

    This course is very good :)

  • @ameybhandari6865
    @ameybhandari6865 Год назад +1

    Thanks harry for this video.

  • @AnkitKumar-pm6vj
    @AnkitKumar-pm6vj 3 года назад +13

    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❤️❤️❤️❤️❤️❤️

    • @ashmitakour8262
      @ashmitakour8262 3 года назад

      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.

    • @humaali4636
      @humaali4636 3 года назад

      I totally agreee with u

  • @shivamrai1322
    @shivamrai1322 3 года назад

    Superb haary bhai

  • @yashsk4682
    @yashsk4682 Год назад +1

    Thank you very much harry bhai.

  • @JenuHDMI
    @JenuHDMI Год назад +1

    Thanks Harry Bhai For This Course ❤

  • @Karthik-kt24
    @Karthik-kt24 3 года назад

    Thank you very much harry bhaiya🙏 u are helping everyone soo much🙏thanks for educating millions for free!! Seriously may God bless you bhai🙏🙇‍♂️

    • @sanafatima1759
      @sanafatima1759 2 года назад

      Did you saw all of his videos and how good are you at coding now

  • @vaniyash3074
    @vaniyash3074 Год назад

    Dear Harry, This video help me a lot, Thanks.

  • @Zeus-xr4dc
    @Zeus-xr4dc Месяц назад

    bhai your channel and websites is a GOLD MINE!!!!!!!!!!!

  • @vanraj8169
    @vanraj8169 2 года назад

    Keyboard noice is so satisfying man!!😍

  • @Cherry-fl4zp
    @Cherry-fl4zp 2 года назад +1

    Thank you sir!❤️

  • @Kumarsingh-p23
    @Kumarsingh-p23 3 года назад

    You are very hard working person

  • @sumitsinghchauhan4330
    @sumitsinghchauhan4330 Год назад +1

    i am happy with this explanation

  • @vidhya821
    @vidhya821 2 года назад

    If i only i had met someone like you in my engg days, i would love programming :|

  • @godlikeofficial9635
    @godlikeofficial9635 3 года назад +2

    You are a greate teacher ........your all video are so intrusting and meaningfull.....keep it up 👍👍

    • @sanafatima1759
      @sanafatima1759 2 года назад

      Did you saw all of his videos and how good are you at coding now

  • @gkanything9567
    @gkanything9567 3 года назад

    Thanks a lot sir 🔥 🔥 🔥 🔥

  • @Sujan_Das14
    @Sujan_Das14 3 года назад +1

    Sir u are the only good thing happening to me this year

    • @sanafatima1759
      @sanafatima1759 2 года назад

      Did you saw all of his videos and how good are you at coding now

  • @VIKAS-yu9fc
    @VIKAS-yu9fc 3 года назад

    Thank you very much sir

  • @royfamily9273
    @royfamily9273 Год назад +1

    Thanks Harry Bhaiya

  • @sudharshanvijay2337
    @sudharshanvijay2337 Год назад

    Thank you ! Liked

  • @girishmasule6252
    @girishmasule6252 3 года назад

    Really great

  • @thunderbolt3017
    @thunderbolt3017 3 года назад +1

    U r doing really good job for us, bhagwan tumhe disha ptaani ki dilaye

  • @eaglehunter6487
    @eaglehunter6487 3 года назад

    Harry bhai aap bahut accha padhte ho hats off to you

  • @susmitakundu3098
    @susmitakundu3098 3 года назад

    Really amazing video

  • @rajvlogs7688
    @rajvlogs7688 Год назад

    you're genius Harry Bhai 😊.

  • @after_padhaigaming393
    @after_padhaigaming393 Год назад

    Tank u bhaiya for all this great lectures.. 🙂

  • @trideepbaruah5590
    @trideepbaruah5590 3 года назад

    Very helpful

  • @dorababuarig765
    @dorababuarig765 3 года назад

    Clearly understood Harry bayya

  • @sharuk3545
    @sharuk3545 3 года назад

    amaaazing mza aa gya

  • @oyepuru
    @oyepuru 3 года назад +10

    Next Roadmap Please Competitive Programing 🙏🙏🙏🙏🙏

  • @ruchimantri1113
    @ruchimantri1113 3 года назад +2

    your videos are so damn helpful !! THANK YOU SO MUCH for these :))))

    • @sanafatima1759
      @sanafatima1759 2 года назад

      Did you saw all of his videos and how good are you at coding now

  • @sjprpd
    @sjprpd 2 года назад +4

    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

  • @jesuslovesyou590
    @jesuslovesyou590 3 года назад +1

    Loving this Java cource sir 👍

    • @sanafatima1759
      @sanafatima1759 2 года назад

      Did you saw all of his videos and how good are you at coding now

  • @masudsk5674
    @masudsk5674 3 года назад

    awsm vdo bhaiya

  • @deepaktiwari-ry9yo
    @deepaktiwari-ry9yo 3 года назад

    Thanks for the nice video

  • @ashishnath4719
    @ashishnath4719 3 года назад

    Thank you Harry bhaiya

  • @raushanraj227
    @raushanraj227 2 года назад

    Op :) Playlist

  • @w.intelli7721
    @w.intelli7721 3 года назад

    Thank you harry bhai

  • @Sujan_Das14
    @Sujan_Das14 3 года назад +2

    U are a star harry bhai

  • @jagadeshgarrepally4251
    @jagadeshgarrepally4251 Год назад

    Thank you so much brother I am Telugu, but I understand only Your classes, really great.

  • @siddhant3725
    @siddhant3725 3 года назад +1

    You deserve more than 1000 million subscribers

  • @RehanAliArman-mt8pr
    @RehanAliArman-mt8pr 3 месяца назад

    amazing lectures thank very much🤩🤩😍

  • @hydrarakesh7150
    @hydrarakesh7150 Год назад

    Mazza aarha I'll see you next time❤️💡😘

  • @AllinOne-nw9eh
    @AllinOne-nw9eh 3 года назад +1

    Nice Java Tutorial

  • @shantanuhiwrale9843
    @shantanuhiwrale9843 2 года назад

    Amazing java course

  • @sukhpreetsingh5200
    @sukhpreetsingh5200 2 года назад

    Congratulations Harry bhai 3million done and more to come ❤️🥳

  • @hetvifuria7174
    @hetvifuria7174 2 года назад

    thank you!!!!!

  • @stevefox2318
    @stevefox2318 3 года назад

    waaahh harry bro after so long java oops smjh aya

  • @priyagupta-qr8tv
    @priyagupta-qr8tv 3 года назад

    very fruitful video. i have one request that plz make videos on .net development. i really like your teaching way.. ty sir.. tysm

  • @redpersimmon6940
    @redpersimmon6940 3 года назад

    Thankyou 😘😃

  • @code4031
    @code4031 3 года назад

    behtreen yar

  • @avinashdharme2234
    @avinashdharme2234 3 года назад

    Helpfull video

  • @Payal_Sharma_0019
    @Payal_Sharma_0019 Год назад

    Seriously thank you

  • @abhinabdas8661
    @abhinabdas8661 3 года назад

    Bhaijaan ❤️ tussi great ho

  • @ayushkaushik2459
    @ayushkaushik2459 3 года назад

    Thank you Harry bhai i got my hacktober fest t-shirt ❤️😍

  • @vikrampatil5837
    @vikrampatil5837 2 года назад

    Thank you bhaii 🤩👍

  • @sourabhpal6437
    @sourabhpal6437 2 года назад

    amazing sir you are the best thank you so much sir

  • @nitishsingh814
    @nitishsingh814 Год назад

    Nice Man

  • @subzeroforyou3728
    @subzeroforyou3728 3 года назад

    thank you sir

  • @navyanshtechnicalpoint3000
    @navyanshtechnicalpoint3000 3 года назад

    Sir I got 2020 Hacktober Fest T-Shirt..A Huge Thanks for introducing it to commoners.

  • @shaileshhacker
    @shaileshhacker 3 года назад

    Thank You

  • @karnavpanchal3281
    @karnavpanchal3281 3 года назад +2

    Abhi programming me maja aaya na bhidu !!!!! ye dukh finally khatam ho gaya ;)

  • @ashwinipalkar18
    @ashwinipalkar18 2 года назад

    👍too good sir

  • @shreyashkumar1298
    @shreyashkumar1298 3 года назад

    thanks harry sir

  • @mohammedajmal4264
    @mohammedajmal4264 2 года назад

    THANK YOU 🤩🤩

  • @StudioSix9
    @StudioSix9 11 месяцев назад

    Thank You Sir

  • @omchandwadkar4395
    @omchandwadkar4395 Год назад +1

    good ex. on object oriented programming broo

  • @hiyabhattacharya6569
    @hiyabhattacharya6569 2 года назад

    I am greatful to you

  • @v2factsandupdates327
    @v2factsandupdates327 2 года назад

    Nice lecture

  • @Sujeet12656
    @Sujeet12656 3 года назад

    your are best