[Tutorial] Java Inheritance - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Java Programming (https://www.supportforums.net/forumdisplay.php?fid=22) +---- Thread: [Tutorial] Java Inheritance (/showthread.php?tid=1477) |
[Tutorial] Java Inheritance - Eustaquio - 10-14-2009 Hi! I'm here again to explain you more about java and it's programmation, in this part of the tutorial I'm gonna explain some about inheritance and how it works. This part it's easy when you know what are the objects and classes, I explained it in my second tutorial, Java 2 (Classes, objects and methods) . The inheritance it's a good part for not to do COPY & PASTE of a bunch of code, so this will help you not to write a lot and do the program easy to understand. This is one of the most important parts and it's the base of the objects programmation, so it's useful because of the inheritance and polymorphism that I'm going to explain in the next tutorial, that maybe I'm going to do it today, so you will be able to learn a lot today! LET'S START!!!!!!!!!!!!! Inheritance is useful when you have to make a program about something that have some kind of that something this is hard but it's easy to understand when you learn an example, here is: A program like a shop car, there is a Class named Car, (Yes!! Like I wrote in the second tutorial ) and a kind of car are the Ferrari, that are more powerful than Honda for example, so, there is a FATHER class and two or more CHILD classes see: Code: ------------------------- (So It's like a family, yes ) Now, the methods that are written in the class CAR, the child classes are going to know it's methods so it's not needed to write it AGAIN!!! (wooooooow it's for lazy people!! Yeah, for me ) then, MAKE ME AN EXAMPLE! yes! I was going to do it now! Code: class Car { Easy, no? BUT HOW CAN I USE IT?!?!?!? Shhh, calm, I'm going to do a main class to show people how to use. Code: Code: class Car { This is the end with a full example explaining and now, let's make your own!! See you in the next tutorial!! about polymorphism!!! +rep is welcome RE: [Tutorial] Java Inheritance - Guerreiro - 10-14-2009 Keep up the tuts. Some nice examples and I hope all the starters can follow you. RE: [Tutorial] Java Inheritance - chinaman7x7 - 10-15-2009 nice tut.........sure going to help me.......... RE: [Tutorial] Java Inheritance - Eustaquio - 10-16-2009 Thank you, I wrote them for another forum but I have copied them to here, now, I'll write more, but I have no ideas for doing more tutorials for basic java, I'm not any expert ^^ |