Java Practice Questions on Abstract Classes & Interfaces

Поділитися
Вставка
  • Опубліковано 17 гру 2024

КОМЕНТАРІ •

  • @ECVivekSinghBhadouria
    @ECVivekSinghBhadouria 4 роки тому +57

    Harry Bhai, I just started your web development course and completed 10 videos in a single sit(this is how impressive your teaching skills are). Thank you, to make this very valuable course for free. Lots of love and respect.

    • @saniyamalik6718
      @saniyamalik6718 Рік тому +2

      It's been two years, how is it going?

    • @LEGENDKINETIC
      @LEGENDKINETIC 8 місяців тому

      @@saniyamalik6718 it's been 8 months, how is your Java course going?? + he didn't replied about web dev 😆

    • @saniyamalik6718
      @saniyamalik6718 8 місяців тому

      @@LEGENDKINETIC it's going pretty well , but this course is for beginners. So if you wanna learn java deeply, there's so much more that you can look into

    • @LEGENDKINETIC
      @LEGENDKINETIC 8 місяців тому +1

      @@saniyamalik6718 Ohh, thanks for replying!
      1. so much more as??
      2. What do you wish you could tell me right now that, if you had known it 8 months ago, would have helped you a lot?

    • @AbyssWalker-s6d
      @AbyssWalker-s6d Місяць тому

      @@LEGENDKINETIC it's been 6 months, how is yours going??

  • @harshjethwani6821
    @harshjethwani6821 3 роки тому +15

    Best online JAVA course , thank you Harry sir

  • @princenagar1686
    @princenagar1686 Рік тому +3

    completed harry bhai java playlist's 60th video!!!!
    already learnt touch typing to learn all languages....
    and thankyou very much Harry bhai for every video, i am learning java as my first language

  • @tusharnarang4334
    @tusharnarang4334 4 роки тому +38

    question 4:-
    abstract class Telephone{
    abstract void ring();
    abstract void lift();
    abstract void disconnect();
    }
    class SmartPhone extends Telephone{
    @Override
    void ring() {
    System.out.println("Ringing...");
    }
    @Override
    void lift() {
    System.out.println("picking up the call ");
    }
    @Override
    void disconnect() {
    System.out.println("Disconnecting the call...");
    }
    void openGps(){
    System.out.println("Opening the MAPS..");
    }
    }
    public class Question_04 {
    public static void main(String[] args) {
    Telephone t= new SmartPhone();
    //t.openGps();//--> this will throw an error cz telephone doesn't have openGps() method.
    t.lift();
    }
    }

  • @fatimataiba5294
    @fatimataiba5294 3 роки тому +2

    Yesterday I have commented that I don't understand but today with complete concentration I have completed this whole PS by myself Thank you so much...credit goes to you

  • @rubysingh3080
    @rubysingh3080 2 роки тому +1

    Harry bhai ki videos ki best cheez hai, topics cover hone k baad practice k liye questions bhi milte hain jisse concepts aur bhi clear ho jate hain plus long time k liye yaad bhi rahte hain.

    • @Niko_Bellic1
      @Niko_Bellic1 11 місяців тому

      bhai isme for real PURI java hai????? kyuki mujhe topics missing bhi dikh rahe

  • @pubgclutches8481
    @pubgclutches8481 3 роки тому +14

    Question 4-->
    abstract class Telephone {
    abstract void ring();
    abstract void lift();
    abstract void disconnect ();
    }
    class SmartPhone extends Telephone{
    public void ring(){
    System.out.println("ringing...");
    }
    public void lift(){
    System.out.println("lifting up the phone");
    }
    public void disconnect (){
    System.out.println("call disconnected...");
    }
    }
    public class MyClass {
    public static void main(String args[]) {
    Telephone t = new SmartPhone();
    t.ring();
    SmartPhone s = new SmartPhone ();
    s.lift();
    }
    }
    Question 6 :
    interface TVRemote{
    void changeChannel();
    void turnOffTV();
    }
    class SmartTVRemote implements TVRemote{
    public void changeChannel(){
    System.out.println("changing the channel...");
    }
    public void turnOffTV(){
    System.out.println("Turning Off TV...");
    }
    public void useAsACController(){
    System.out.println("using as AC Controller mode...");
    }
    }
    public class MyClass {
    public static void main(String args[]) {
    TVRemote t = new SmartTVRemote();
    t.changeChannel();
    }
    }
    (Tell me if I'm wrong in this question because I'm bit confused about question)
    Edit: thankyou so much guru ji for teaching too good ❤️

  • @gajananpande2980
    @gajananpande2980 2 роки тому +2

    You are doing a very good job Harry Brother. I used to think Programming and high level language must be very hard to learn and coding is impossible for me. . You made java piece of cake for everyone.

  • @smrutiranjan779
    @smrutiranjan779 11 місяців тому

    i did all of these questions before watching the solution , i am happy to say , i solved all off these questions myself without facing any problem. thank you harry bhai😍

  • @anantchandak9574
    @anantchandak9574 3 роки тому

    I thought
    1 month ago - computer me bas game khelte gai
    After seeing harry video -
    computer me ham game bana sakte hai
    Thanks bhai 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

  • @marcus9013
    @marcus9013 2 роки тому +1

    This practice set is very very easy from other practice set and also learn a lot from this Chapter ❤❤

  • @nealbangia147
    @nealbangia147 2 роки тому +1

    Harry bhai you are seriously awesome 👍 i learned java from your videos it's really helpful to me to understand each concept..
    Lots of love and respect 🙏

  • @HamzaShahzadEB_
    @HamzaShahzadEB_ 2 роки тому +2

    After watching your videos it seems like that this concepts are nothing but abc😇

  • @kaushalkhachane1637
    @kaushalkhachane1637 4 роки тому

    Mai shurvaat se aapka java ka course kr raha hoon sach mai maja aa gaya 😘🥰😍

  • @deadly-gamer2657
    @deadly-gamer2657 2 роки тому +1

    humour is unbeatable in your videos.

  • @asifhabib9502
    @asifhabib9502 3 роки тому +4

    in question 4th , while implementing polymorphism (Telephone st = new SmartTelephone(); ) . on calling st.lift() how is it taking declaration in class SmartTelephone? Here's my code :
    abstract class Telephone{
    abstract void ring();
    abstract void lift();
    abstract void disconnect();
    }
    class SmartTelephone extends Telephone{
    public void ring(){
    System.out.println("ringing ...");
    }
    public void lift(){
    System.out.println("Lifting ...");
    }
    public void disconnect(){
    System.out.println("Disconnected. ");
    }
    }
    public class oops_questions {
    public static void main(String[] args) {
    Telephone st = new SmartTelephone();
    st.disconnect(); // --> this prints Disconnected. that means it is taking declaration from class SmartTelephone // and not from Telephone
    st.lift(); --> prints Lifting...
    st.ring();
    }
    }

    • @faisal7980
      @faisal7980 3 роки тому

      But why will he lift ...anyway ....
      I am confused ... Telephone st...how will it work ?? It will give error ....

    • @nedariyamohd6736
      @nedariyamohd6736 3 роки тому

      @@faisal7980 nope brother all methods are part of interface its has taken refrence of interface(Telephone) and make object of child class(Smartphone) that will work fine!!

  • @amritroy6768
    @amritroy6768 2 роки тому +1

    The sense of humour can be measured in Harry's unit! 😂

  • @GracefulPortraits
    @GracefulPortraits 4 роки тому +2

    Your vedios are soo awesome plz give me a dil Harry bhai

  • @priyanshuverma26
    @priyanshuverma26 4 роки тому +2

    Good content 60th video

  • @anitsarkarxi-a-6595
    @anitsarkarxi-a-6595 4 роки тому

    YOUR CORSES ARE FREE..BUT THIS CORSES VALUE IS ABOVE THE NET WORTH OF JEFF BEZOS. YOU ARE A BEST Teacher IN THE WORLD

  • @shivisaxena2798
    @shivisaxena2798 3 роки тому +1

    Yes I am Loving this course..😁

  • @sakshamjain7930
    @sakshamjain7930 3 роки тому

    Completed all the Questions!

  • @mayanksharma7952
    @mayanksharma7952 4 роки тому

    Harry Bhai we can't thank enough for your efforts .aap ek video bna do Jo bilkul kuch nhi jante coding ke baare me wo kaha se shuru kre ?

  • @rayyankhan_4
    @rayyankhan_4 3 місяці тому

    harry bhai java mai dsa and algorithms smajha dije..... aur agr ap nahi samjha sakte kisi kam m busy ho to ye bata sakte h ki agr m sirf java seekhra hu to kya apke C language wali playlist se dsa samjh skta hu ke confusion hoga ? u r the best teacher

  • @anamika_deb
    @anamika_deb 3 роки тому +1

    Course bht aacha h 💜

  • @alishykhs
    @alishykhs Рік тому +3

    Question 6:
    interface tvremote{
    void next();
    }
    interface mobile extends tvremote{
    void camera();
    }
    class abdullah implements mobile{
    @Override
    public void next() {
    System.out.println("next channel");
    }
    @Override
    public void camera() {
    System.out.println("opening camera");
    }
    }
    public class Main {
    public static void main(String[] args) {
    tvremote abdullah1 = new abdullah();
    abdullah1.next();
    }
    }

  • @mastiwithaishvi337
    @mastiwithaishvi337 4 роки тому +2

    Projects laiye pls isme bhi jaise aap python me laye the bahut maza aata tha python ke projects banane me........

  • @Aayush-cd3dc
    @Aayush-cd3dc 4 роки тому +1

    Sir please make more projects in django..you are nest teacher and youtuber in world🔥

  • @anjaliasthana6576
    @anjaliasthana6576 4 роки тому

    Harry sir please its my humble request and plz dont ignore this comment that Computer Scientist Banne par roadmap banaiye jald se se jald is par video banaiye kyonki mujhe bade hokar computer scientist banna hai plz sir is topic par video banaiye plz plz plz its my humble request you are real teacher and i am inspired by you. i cant describe your qualities in this one comment so plz computer scientist banne par roadmap banaiye

    • @anjaliasthana6576
      @anjaliasthana6576 4 роки тому

      You are my idle sir I love you sir really I love sir from my heart

  • @abhitesh323
    @abhitesh323 2 роки тому

    hat's off sir, love the way you teach.

  • @AyushKumar-cr1et
    @AyushKumar-cr1et 4 роки тому +10

    Please complete Data Structures and Algorithms course 🙏🙏

  • @_yatharth_.07
    @_yatharth_.07 4 роки тому +2

    Please sir made a tutorial video on SQL for beginners and also on is we need to learn SQL

  • @waqasofficial6509
    @waqasofficial6509 4 роки тому +2

    Harry Bhai Love you

  • @techsciencewitha.k.9042
    @techsciencewitha.k.9042 3 роки тому

    bhai ye vala practice set bhot easy laga.....no problem

    • @sanskarkedia2696
      @sanskarkedia2696 3 роки тому

      //Q6 and Q7. Hope it helps!!
      interface TvRemote{
      void volumeUp(int inc);
      void volumeDown(int dec);
      }
      interface SmartTvRemote extends TvRemote{
      void Netflix();
      void AmazonPrime();
      void UA-cam();
      }
      class Tv implements SmartTvRemote{
      public int volume;
      public Tv() {
      this.volume = 100;
      }
      @Override
      public void volumeDown(int dec) {
      volume = volume - dec;
      }
      @Override
      public void volumeUp(int dec) {
      volume = volume + dec;
      }
      @Override
      public void Netflix(){
      System.out.println("Opening Netflix ...");
      }
      @Override
      public void UA-cam(){
      System.out.println("Opening UA-cam ...");
      }
      @Override
      public void AmazonPrime(){
      System.out.println("Opening AmazonPrime ...");
      }
      }
      public class Practice {
      public static void main(String[] args) {
      Tv obj = new Tv();
      obj.Netflix();
      obj.volumeDown(20);
      System.out.println(obj.volume);
      }
      }

  • @technikalproblem6780
    @technikalproblem6780 Рік тому

    Thanks a lot sir for creating this video!

  • @PradeepKumar-eg2yh
    @PradeepKumar-eg2yh 4 роки тому +3

    Hello sir please make a series on React js please

  • @diptimitra607
    @diptimitra607 2 роки тому

    abhi ke liye itna hi kal milte hein..good night and once again thank you so much😇

  • @vinaykumar9688
    @vinaykumar9688 2 роки тому +1

    5:06 epic 😂

  • @AbdullahKafi-wp2me
    @AbdullahKafi-wp2me 4 місяці тому

    video 60 & practice done ✅✅✅✅

  • @SangeetaSingh-gm9kp
    @SangeetaSingh-gm9kp 4 роки тому +1

    please make a summary of all your big big projects and also make big big projects like games apps a.i machine learning and software's by coding thank you harry bhaiya

  • @vaibhavsingh2197
    @vaibhavsingh2197 4 роки тому +32

    Thinking about his friends lavish reaction after seeing the video😂😂

  • @viralvideoa
    @viralvideoa 2 роки тому

    4:49 and here we go, always logical😁😁

  • @manjulagarg6227
    @manjulagarg6227 4 роки тому

    Lovely course bhai. Please give me a heart...

  • @royalsgaming03
    @royalsgaming03 3 роки тому

    Harry bhai ynha tak pauncha hu abhi ess course me😁

  • @sandhya5042
    @sandhya5042 9 місяців тому

    Thank you so much for your hardwork 😊

  • @rohityk8971
    @rohityk8971 4 роки тому

    Sir pura course notes ek pdf me mil saktha hai ky! Agar sab pdfs ka ek Google drive link bhi mil jaatha toh Acha hota, and rest of that, your are great sir your teaching are easy to grasp. keep going 👍

  • @aasheesh_sahu
    @aasheesh_sahu 4 роки тому +1

    HARRY BHAI OP 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥

  • @narendrasuthar3734
    @narendrasuthar3734 4 роки тому +2

    Make setup tour video harry bhai

  • @TechAyush001
    @TechAyush001 2 роки тому

    You're too good Harry bhai

  • @krishnabpatil3027
    @krishnabpatil3027 4 місяці тому

    This is the only exercise which I solved without Help....

  • @raghavdwivedi111
    @raghavdwivedi111 2 роки тому

    5:00 , BITE KARTA HAI BHAI' 😂😂😂😂😂

  • @khizarameen4301
    @khizarameen4301 2 роки тому

    sir jo baat hain mazaa ah gaya

  • @rajatchaurasia3578
    @rajatchaurasia3578 3 роки тому +1

    Present air ❤👌🏻❤👌🏻👌🏻❤❤👌🏻👌🏻❤

  • @SK8BOTGAMING
    @SK8BOTGAMING 3 роки тому +2

    to easy and basic questions please make some difficult programs...

  • @anshdholakia714
    @anshdholakia714 4 роки тому +2

    Answers:
    Question 4:
    abstract class tele{
    abstract void ring();
    abstract void lift();
    abstract void disconnect();
    }
    class SmartTele extends tele{
    public void camara(){
    System.out.println("Taking photo");
    }
    public void record(){
    System.out.println("Recording");
    }
    public void ring() {
    System.out.println("Ringing!");
    }
    public void lift() {
    System.out.println("Picked the call!");
    }
    public void disconnect() {
    System.out.println("Disconnected!");
    }
    }
    in main function:
    tele obj=new SmartTele();
    obj.disconnect();
    SmartTele obj2=new SmartTele();
    obj2.camara();
    Question 6:
    interface tvremote{
    void on();
    void off();
    }
    interface smarttvremote{
    void youtube();
    void news();
    void games();
    }
    class modernremote implements tvremote,smarttvremote{
    @Override
    public void on() {
    System.out.println("On!");
    }
    @Override
    public void off() {
    System.out.println("Off!");
    }
    @Override
    public void games() {
    System.out.println("Play games");
    }
    @Override
    public void youtube() {
    System.out.println("Open youtube!");
    }
    @Override
    public void news() {
    System.out.println("Watch news!");
    }
    }
    in main method:
    smarttvremote obj=new modernremote();
    obj.youtube();
    Question 7:
    interface tvremote{
    void on();
    void off();
    }
    interface smarttvremote{
    void youtube();
    void news();
    void games();
    }
    class tv implements tvremote{
    @Override
    public void on() {
    System.out.println("On!");
    }
    @Override
    public void off() {
    System.out.println("Off!");
    }
    }
    in main function:
    tv obj=new tv();
    obj.on();

    • @madhusudan9479
      @madhusudan9479 4 роки тому

      Did you know Java properly.?
      What are you studying right now...

    • @anshdholakia714
      @anshdholakia714 4 роки тому

      @@madhusudan9479 No, I am a beginner in Java. I am currently studying Django

  • @StudioSix9
    @StudioSix9 Рік тому

    Nice 1

  • @sudharshanvijay2337
    @sudharshanvijay2337 Рік тому

    Thank you! Liked

  • @samirsingh9575
    @samirsingh9575 4 роки тому +1

    Harry bhai please complete dsa playlist🙏🙏

  • @Someone-kw6mw
    @Someone-kw6mw 4 роки тому +5

    I want you to beat clever programmers in subs!
    good luck with that thing
    BTW: anyone know's Brackeys

    • @varadpawar4241
      @varadpawar4241 3 роки тому +1

      1. He has beaten clever programmer.
      2. I know. He is a game developer

    • @faisal7980
      @faisal7980 3 роки тому

      He is one of the best web developer/frontend/ui ux with multiple real world examples .

  • @viveksaboo
    @viveksaboo 2 роки тому

    lavish is not hurted in this video😜

  • @maulikmishra3885
    @maulikmishra3885 4 роки тому +1

    Harry sir, please add the 61st in the playlist

  • @Nikhil-nh4es
    @Nikhil-nh4es 3 роки тому +1

    Sir,Please make course on C GTK

  • @maddycoder1294
    @maddycoder1294 3 роки тому

    yes harry bhai we are enjoing

  • @basitiqbalc4521
    @basitiqbalc4521 2 роки тому +1

    q no :6
    interface tv_remote
    {
    public void on();
    }
    interface smart_tv_remote extends tv_remote
    {
    public void of();
    }
    class dis implements smart_tv_remote
    {
    public void on()
    {
    System.out.println(" tv is on ");
    }
    public void of()
    {
    System.out.println(" tv is of ");
    }
    }
    public class Main
    {
    public static void main(String[] args) {
    dis d = new dis();
    d.on();
    d.of();
    }
    }

  • @Shubham-hk6yf
    @Shubham-hk6yf 2 роки тому +1

    4:47 just killed me

  • @thatonichan
    @thatonichan 3 роки тому +2

    all concepts are clear now. thanks are lot sir : )

  • @siddhantyadav4531
    @siddhantyadav4531 3 роки тому

    Thanks a lot Sir 👍👍👍👍👍👍

  • @miteshkumarnavale2280
    @miteshkumarnavale2280 4 роки тому

    Bhai CMD ki trick ka video banao it's very important....❤️❤️❤️❤️❤️❤️

  • @ahemadabbas2062
    @ahemadabbas2062 4 роки тому +1

    Sir kuch aesa app banao jisme ham apke Programming languages ke video dekh sake offline me

  • @titanharshil6584
    @titanharshil6584 4 роки тому

    Sir kya aapne HTML and HTML 5 pe video banai he ? Agar nahi banai heto banado Sir please
    Big fan sir ❤️

  • @abhisiktaghosh6607
    @abhisiktaghosh6607 7 місяців тому

    Thank you 😊👍🏻

  • @madhusudan9479
    @madhusudan9479 4 роки тому

    Harry bhai please answer my question 🙏 Kya apko pata hai ki opreting system kaise banaya jata hai 🤔 aur वो भी C language me.??

  • @sujitlendave2172
    @sujitlendave2172 4 роки тому +1

    Bhai computer engeenering ke liya best laptop konsa hai plz

  • @janvibahuguna865
    @janvibahuguna865 4 роки тому

    congratulation for channel veriffication .' )

  • @alexsimons3804
    @alexsimons3804 3 роки тому

    Thank you so much❣❣

  • @maheshmahadar4780
    @maheshmahadar4780 4 роки тому

    awsome explaination .....

  • @codemc7376
    @codemc7376 2 роки тому

    all done nice video

  • @VolatileGuy103
    @VolatileGuy103 2 роки тому

    thank you for everything

  • @gkanything9567
    @gkanything9567 3 роки тому

    Thanks a lot sir 🔥 🔥 🔥 🔥

  • @smitshah5458
    @smitshah5458 4 роки тому +3

    What is the difference between dynamic method dispatch and polymorphism ?

    • @abheygupta2332
      @abheygupta2332 4 роки тому +9

      Polymorphism is a general term in OOPS..
      Dynamic method dispatch is a concept based on polymorphism
      Hope it helps...

  • @Allin-dd8gj
    @Allin-dd8gj 2 роки тому

    Yes really I enjoy

  • @prabhatsingh9512
    @prabhatsingh9512 4 роки тому +3

    Bhaiya please tell that C++ Lecture and ds algorithm lectures are fully completed or not🙏🙏🙏🙏

    • @madhusudan9479
      @madhusudan9479 4 роки тому +1

      I saw that you told भैया so my question is in which class you are. What are you studying right now. I'm also teenager I also have much interest in coding but not getting a good teacher.
      Please reply 🙏 because I am finding more teenagers like me...

    • @prabhatsingh9512
      @prabhatsingh9512 4 роки тому

      @@madhusudan9479 actually i am going to take admission this year in college and Now i am learning coding as i have it in my 11th and 12th so i have interest in C++

    • @madhusudan9479
      @madhusudan9479 4 роки тому

      @@prabhatsingh9512 Thanks 😊 for reply

  • @pulkit8133
    @pulkit8133 2 місяці тому +1

    ques 6
    interface TvRemote{
    void TurnON();
    }
    interface SmartTvRemote extends TvRemote{
    void TurnOFF();
    }

  • @Aayush-cd3dc
    @Aayush-cd3dc 4 роки тому

    Sir please make video on shopping website in one video with use of django...please sir🙏

  • @w.intelli7721
    @w.intelli7721 3 роки тому

    Thank you harry bhai

  • @anshulshrivastav7687
    @anshulshrivastav7687 4 роки тому

    solved all the questions.

  • @mohdtausif
    @mohdtausif 4 роки тому

    Harry Bhai please make a series on React Js 🙏

  • @rasoiqueen2871
    @rasoiqueen2871 4 роки тому

    Unlimited source for codings

  • @VINITPANDEYIITJEE
    @VINITPANDEYIITJEE 4 роки тому +1

    Thanks

  • @mohdtausif
    @mohdtausif 4 роки тому

    Harry Bhai please make a series on React Js and Bootstrap 5 also.

  • @shivanshutyagi83
    @shivanshutyagi83 4 роки тому

    Harry bhai 👋👋

  • @sadashish2002
    @sadashish2002 4 роки тому

    Bhaiya Java full course ka total no. Of video kitna hoga ,plz next video m bataaa dijyega 🙏🙏

  • @ratnakantahanse2661
    @ratnakantahanse2661 4 роки тому

    Thank you sir...

  • @vishalgupta7478
    @vishalgupta7478 3 роки тому +1

    monkey bite 🤣🤣🤣🤣example was outstanding

  • @punamthakare625
    @punamthakare625 4 роки тому

    Sir please make a video on cyber security 🙏🙏

  • @shaileshhacker
    @shaileshhacker 3 роки тому

    Thank You

  • @mdmatiurrahman7373
    @mdmatiurrahman7373 4 роки тому

    Sir please make a full course on *Laravel_* ..please....do it......please....We need a full course on laravel....

  • @amanverma8300
    @amanverma8300 4 роки тому

    Please, make some tutorial on REACT...

  • @PradeepKumar-eg2yh
    @PradeepKumar-eg2yh 4 роки тому

    Sir please make a series on React js

  • @dheerajchavan45
    @dheerajchavan45 Рік тому +1

    Q.1 , Q.2 ---------->
    abstract class Pen {
    abstract void write ();
    abstract void refill ();
    }
    class FountainPen extends Pen {
    FountainPen() {
    System.out.println("open the cap ");
    };
    void write () {
    System.out.println("Writing");
    };
    void refill (){
    System.out.println("Fueling");
    }
    }
    public class Patternsample {
    public static void main(String[] args) {
    FountainPen f = new FountainPen();
    f.write();
    f.refill();
    }
    }
    Q.3 ---------->
    class Monkey {
    void jump () {
    System.out.println("jumping");
    };
    void bite (){
    System.out.println("biting");
    }
    }
    interface BasicAnimals {
    void eat () ;
    void sleep () ;
    }
    class Human extends Monkey implements BasicAnimals {
    void speak () {
    System.out.println("speaking loudly");
    }
    public void eat () {
    System.out.println("eating cooked food");
    }
    public void sleep () {
    System.out.println("always sleeping");
    }
    }
    public class Patternsample {
    public static void main(String[] args) {
    Human h1 = new Human();
    h1.speak();
    }
    }