Inheritance Example 3- Room - Java

Program:
class Room
{
   int length,width;
   Room(int a,int b)
   {
     length = a;
     width = b;
   }
   void area()
   {
     int area = length*width;
     System.out.println("The area of the room is " +area);
   }
}

class roomvol extends Room
{
   int height;
   roomvol(int a,int b,int c)
   {
     super(a,b);
     height = c;
   }
   void volume()
   {
     int volume = length*width*height;
     System.out.println("The volume of the room is " +volume);
   }
}

class inheritance3
{
   public static void main(String args[])
   {
     roomvol room2 = new roomvol(10,40,20);
     room2.area();
     room2.volume();
   }
}

Output:
nn@linuxmint ~ $ javac inheritance3.java
nn@linuxmint ~ $ java inheritance3
The area of the room is 400
The volume of the room is 8000
nn@linuxmint ~ $

75 comments:

  1. Good work sir, Thanks for the proper explanation about Inheritance . I found one of the good resource related JAVA and OOPS concepts. It is providing in-depth knowledge on JAVA and OOPS. which I am sharing a link with you where you can get more clear on JAVA and OOPS. To know more Just have a look at this link

    Java Tutorial
    Class and object
    Inheritance
    Polymorphism
    Abstraction
    Encapsulation

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Video editing course in Noida
    Video editing training institute in Noida- Webtrackker Technology is and IT Training institute providing the Video editing course in Noida, FCP, Final Cut Pro Training in Noida. For more call us- 8802820025.
    Video editing course in Noida
    Company Address:
    Webtrackker Technology
    C- 67, Sector- 63, Noida
    Phone: 01204330760, 8802820025
    Email: info@webtrackker.com
    Website: http://webtrackker.com/Best-training-institute-Video-editing-FCP-course-in-Noida.php

    ReplyDelete
  5. Cloud Computing Training In Noida
    Webtrackker is IT based company in many countries. Webtrackker will provide you a real time projects based training on Cloud Computing. If you are looking for the Cloud computing training in Noida then you can join the webtrackker technology.
    Cloud Computing Training In Noida , Cloud Computing Training center In Noida , Cloud Computing Training institute In Noida ,

    Company Address:
    Webtrackker Technology
    C- 67, Sector- 63, Noida
    Email: info@webtrackker.com
    Website: www.webtrackker.com
    http://webtrackker.com/Cloud-Computing-Training-Institutes-In-Noida.php

    ReplyDelete
  6. Good article.Thank you for sharing this blog please visit our website.
    ServiceNow Training in Hyderabad

    ReplyDelete
  7. I found this post interesting and worth reading. Thanks for sharing!!
    DevOps Online Training

    ReplyDelete
  8. Certainly this information might be worthwhile and advantageous for numerous apprentices who are learning java. Keep up with this admirable work and continue sharing. Professional Web design services are provided by W3BMINDS- Website designer in Lucknow.
    Web development Company | Web design company

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete

  10. Thank you for sharing such great information very useful to us.
    Java Training in Noida

    ReplyDelete
  11. Discount hotels deal online

    Hotels - Find the low-cost last minute hotels deals package on AirlineDeals.net. We offer the best discount hotels deal online. Book your last minute hotels deals package.

    to get more - https://airlinedeals.net/hotels/

    ReplyDelete
  12. A model is a person with a function either to sell, show or market it industrial products (appreciably style garb in style indicates), or to serve as a visual useful resource for individuals who are creating works of artwork or to pose for images +919910294610.
    Whatsapp number - 9910294610
    Arvind Rawat model in Noida
    Visit here
    Arvind Rawat Model in Noida
    Arvind Rawat Model in Noida

    ReplyDelete
  13. Best kitchen chimney installation and service in NCR
    When cooking with oil, you will see the fact that smoke usually receives emitted in case you often uses the identical oil. Typically, these form of eating places have today's hoods as well as exhaust fans.
    Visit here
    Kitchen Chimney Repair Service in Noida
    Kitchen Kitchen Chimney Repair Service in Vaishali
    Kitchen Kitchen Chimney Repair Service in indirapuram
    Kitchen Kitchen Chimney Repair Service in vasundhra
    Kitchen Kitchen Chimney Repair Service in faridabad


    url
    http://kitchenware.ml/home/kitchen-chimney-repair-service-in-noida
    http://kitchenware.ml/kitchen-chimney-repair-service-in-vaishali
    http://kitchenware.ml/kitchen-chimney-repair-service-in-indirapuram
    http://kitchenware.ml/kitchen-chimney-repair-service-in-vasundhra–
    http://kitchenware.ml/kitchen-chimney-repair-service-in-faridabad

    ReplyDelete
  14. Cheap airline tickets deal


    Are you searching the best Airline Tickets & Last Minute Airline Flights in Nigeria? Get the best Best Airline Tickets & Last Minute Airline Flights at AirlineDeals with the low-cost price.

    to get more - https://airlinedeals.net/flights/

    ReplyDelete
  15. Discount hotels deal online

    Discount Hotels Deal Online - With airline deals you able to get cheap airline tickets deal, Package, last-minute airline flights, discount hotels deal online in last minutes with best affordable prices.
    to get more - https://airlinedeals.net/last-minute-hotels-deals-package/

    ReplyDelete
  16. Discount hotels deal online

    Discount Hotels Deal Online - With airline deals you able to get cheap airline tickets deal, Package, last-minute airline flights, discount hotels deal online in last minutes with best affordable prices.

    to get more - https://airlinedeals.net/last-minute-hotels-deals-package/

    ReplyDelete
  17. Are you looking for Distance Learning Courses in India most of the students choose and apply, Talentedgenex there are many popular courses which attract the students for having distance education. For more info visit this site:- Distance learning courses in India ,

    ReplyDelete
  18. Talentedgenext Way of Online Learning, Distance Education, is an increasing number of becoming popular all over the world due as it has many benefits. For further details visit in this site:- Distance Education Website,

    ReplyDelete
  19. Great! Thanks for sharing such an amazing post and keep blogging...
    DataScience Training In Hyderabad

    ReplyDelete
  20. Your blog post is really very informative & interesting. Thanks for sharing. For more updates on online shopping Coupons & discount Codes please visit Ustraa Discount Coupons

    ReplyDelete
  21. Hi,
    Nice Post, Thanks for sharing,
    Are you a student of any University or College? Or do you have an email address with .edu? Any of either? If yes, then enjoy this cool initiative of Amazon Prime Student by Amazon.
    Visit For More Information: Amazon Student Discount

    ReplyDelete
  22. Really very happy to say, your post is very interesting to read. I never stop myself to say something about it. You’re doing a great job. Keep it up…

    Looking for Hadoop Admin Training in Bangalore, learn from Softgen Infotech provide Hadoop Admin Training on online training and classroom training. Join today!

    ReplyDelete
  23. Flight and hotel packages in Europe

    Find online cheap flight and hotel packages in Europe. We offer the best flight and hotel packages for your holiday tour in Europe. Get affordable flight and hotel deal packages in Europe.

    to get more - https://www.journeypro24.com/destinations/europe/

    ReplyDelete
  24. Confused In Choosing Java Training Institutes?

    you can Find Top 10 Java Training Institutes In gurgaon on Leadsedge, Here you will get all details about the Institutes, even we will Provide you Free Carrer counseling, Free Demo Classes, and 100% Placement Assistance.

    Any Query?
    Contact Us on:-
    Email:- Info@Leadsedge.com
    Mob:- 9818798937
    Visit us on:-https://www.leadsedge.com/gurgaon/java-training

    ReplyDelete

  25. MAPLE DELITE one of the luxurious hotel in Lucknow offers serene refuge of comfort and hospitality, this hotel is located near Shaheed Path, Lucknow and is 10 km from Hazratganj Lucknow & 6 km from Chaudhary Charan Singh International Airport Lucknow.
    Hotels Near Raebareli Road Lucknow
    Hotels Near Lucknow Airport
    Hotels Near SGPGI Lucknow

    ReplyDelete
  26. Pinnacle Learning Destination is a top Bank Clerk Coaching in Noida .Our institute works for the better future of students. Pinnacle provides students with the necessary guidance and knowledge to crack Bank Exams with ease. Our main aim is to help the students to achieve their dreams.

    ReplyDelete
  27. Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging.
    original

    ReplyDelete
  28. IBPS SO employment is conducted to select candidates for the post of IT Officer Marketing Officer, Law Officer and HR/ Personnel Officer. Pinnacle Institute provides the best IBPS SO Coaching in Noida . We have a committed faculty that is inclined towards the professional growth of the students. At Pinnacle Institute, we provide students the required guidance and information to crack IBPS SO Exams with ease.

    ReplyDelete
  29. Thanks for telling me INHERITANCE EXAMPLE 3- ROOM - JAVA
    . Keep it up. Card

    ReplyDelete
  30. Iconic Academic is one of the most popular Web design training Center in Noida . It provides best facilities to students for practice. This Web design training Center in Noida is recommended for professionals and students who wish to learn web development and existing developers who want to expand their skill set. Our students obtain an occasion to work on live projects. Contact Us: 8920928177

    ReplyDelete
  31. Iconic Academic is one of the most popular Web design training Center in Noida . It provides best facilities to students for practice. This Web design training Center in Noida is recommended for professionals and students who wish to learn web development and existing developers who want to expand their skill set. Our students obtain an occasion to work on live projects. Contact Us: 8920928177

    ReplyDelete
  32. I am DR. GURUJI NAVGRAHA from India a spell caster that has been successfully providing results to my clients for over many years. I use nothing but 100% safe and ancient Indian spiritual methods,I will reunite your ex partner back to you, stop an impending divorce or break-up, and bring back the passion, love, lust, communication and commitment between broken lovers. Don't live in a life unfilled without the one you truly desire. Let me show you the real results you've been searching for,My Powerful Indian

    Spiritual Spell are :
    wedding ritual, healing ritual,Divorce stop ritual,separation ritual,love ritual,protection ritual,self-confidence ritual,child ritual,success ritual,Return Lover ritual,restore passion ritual Save Marriage Spells,Prevent Divorce Spells,Cheating ritual Remove Ex ritual,Business increase,Money
    ritual,Famous ritual,Indian Spiritual Healing center is the answer
    Email: casterspell481@gmail.com
    Whatsap: +919108256518
    DR. GURUJI NAVGRAHA

    ReplyDelete
  33. Great blog! Thank you so much I have learned a lot! Please share more blogs with us. how to register a company in Bangalore

    ReplyDelete
  34. This comment has been removed by the author.

    ReplyDelete
  35. Best cell phone in india 2020

    This year we have many new smart phones launched under ₹15,000 with good specifications and best cell phone in india 2020.

    to get more - https://dealheist.in

    ReplyDelete
  36. DIAC Offers 100% placement focused Project training on advance training in industrial automation and find what is plc scada course fees detail in India. Call @9953489987.

    ReplyDelete

  37. Nice Blog. Thanks for sharing with us. Such amazing information.
    academic house london

    ReplyDelete

  38. Comments on this blog are restricted to team members.

    Thanks for sharing great info
    baby swing with lights
    outdoor baby swing
    how to build a swing frame
    swings for baby girls
    cheap baby swing

    Commenting as babyswing85@gmail.com
    Comment as:
    Baby Swings (Google)
    Notify me

    ReplyDelete
  39. Thanks for sharing such posts with us. This is really very interesting topic for your readers to grab more knowledge about it. For more updates on Ajio Discount Coupons , please visit.

    ReplyDelete
  40. I am very grateful for this help. Thanks

    Core java online training India
    Visit us: Java Online Training

    ReplyDelete
  41. I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. Keep up the good work.
    Visit us: Java Online Training Hyderabad
    Visit us: Core Java Online Course
    Visit us: java course
    Visit us: Best Online Java Course

    ReplyDelete
  42. Thumbs up guys your doing a really good job. It is the intent to provide valuable information and best practices, including an understanding of the regulatory process.
    Python Training in Hyderabad
    Python Course in Hyderabad

    ReplyDelete
  43. Great, thanks for sharing this post.Much thanks again. Awesome.
    java course
    learn java online

    ReplyDelete
  44. Hi, I have just started to Learn Java Online. and this blog is really informative for me. Thank you for this blog!

    ReplyDelete

  45. We are the best Share Market training academy in Chennai, offering Tamil market training with technical analysis. Enroll now for stock market classes.for more details contact us: +91 95858 44338, +91 95669 77791

    ReplyDelete
  46. Thanks for sharing very useful and informative blog.Keep up with your work.
    Java training in Nagpur

    ReplyDelete
  47. Want to learn everything about share market? IBBM offers the best Stock Market Courses in Noida. Our experts cover topics from basics of stock market to technical analysis about it. We make you an expert in share market.

    ReplyDelete
  48. informative blog , keep posting and dont forget to checkout our blog java classes in satara

    ReplyDelete
  49. Elevate your proficiency in web development with our Best Mern Stack Course In South Delhi , offering a comprehensive understanding of the MERN technology stack for full-stack expertise.

    ReplyDelete
  50. Emerging as a prominent content creator on YouTube demands strategic moves, and purchasing instant subscribers provides just that advantage. This approach boosts your channel's visibility immediately, making it more appealing to potential viewers and collaborators. With a range of packages designed to suit any budget, it becomes an accessible step for every creator eager to fast-track their growth. The process, prioritizing security and ease, ensures that you can concentrate on producing quality content while your subscriber count rises. This surge in numbers is not just a figure but a testament to your channel's appeal, inviting more organic engagement and fostering a vibrant community. It’s a direct path to elevating your channel’s status, establishing credibility, and enhancing viewer perception. Choosing to buy instant YouTube subscribers catapults your content into the limelight, setting the foundation for long-term success and recognition in the digital arena.
    https://www.buyyoutubesubscribers.in/

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...