DEV Community

Cover image for Java OOPs concept through storyteling
Solo Thought
Solo Thought

Posted on

Java OOPs concept through storyteling

Have a look on the Kunfy Java story where I tried to explain th concepts of Java programming language through real life examples and the the story of Kungufu Panda.

I've written total 3 stories in this series. I covered OOPs concept till Java 17. If you feel this story clear the complex concepts in easy terms, I can plan to cover the concepts of web services, and integration of other popuar concepts like kafka, nginx etc.

In this tutorial, I've tried to cover inheritance, type of classes, abstraction, difference between a class and an object, method overriding, static, scope, final, and many more concepts. I tried o explain not only how they're used but their need too.

Here is the sample code from one of the example

abstract class Oogway {
    private String Calmness; //skill
    private String SoloThought; //skill
    protected String PhoenixBlade;

    abstract public void fight();
}

class Shifu extends Oogway {
    private List<String> pressurePoints;

    public void fight(){
        System.out.println("Defeat with: " + pressurePoints);
    }
    public void fight(String level){
        if(level.equals("final")) System.out.println("Using protected weapon: " + PhoenixBlade);
    }
}

public class Main {
    public static void main(String[] args) {
        Shifu shifu = new Shifu();
        shifu.fight();
        shifu.fight("final");
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)