NEWS: Total Picture Views: 151536 | Total Article Views: 161016 | Top 5 Most Popular Article: 1. Am I Stuck Algorithm with Becker Robot | 2. PickUpThings with Becker Robot | 3. How to read a JSON and work with it | 4. Encrypted Data GUI (Download .Zip) | 5. Create Wall and Things with Becker

Abstract classes Java


Abstract classes, unlike interfaces, are classes. They are more expensive to use because there is a look-up to do when you inherit from them.

Abstract classes look a lot like interfaces, but they have something more : you can define a behavior for them. It's more about a guy saying, "these classes should look like that, and they have that in common, so fill in the blanks!".


//Pseudo code
// I say all motor vehicles should look like this :
abstract class MotorVehicle

    int fuel;

    // they ALL have fuel, so why not let others implement this?
    // let's make it for everybody
    int getFuel()
         return this.fuel;

    // that can be very different, force them to provide their
    // implementation
    abstract void run();


// my team mate complies and writes vehicle looking that way
class Car extends MotorVehicle
    void run()
Attachments: None

Tags: Abstract Classes

Total Views: 957

My name is Jean-Mathieu

I created this website so other people could enjoy finding useful stuff easier. If you have any question do not hesitate to contact me.

jean8mathieuCreated on 09/15/15


Disclosure: We are a website that needs compensation to operate like any other website on the internet.
We may receive consideration for our reviews but we are totally unbiased and do not accept paid reviews or fake reviews claiming to be something they are not.