Skip to content

[Feature] A abstract method could be created #7

@YinChenming

Description

@YinChenming

As title says, the two classes take the same function. I recommend you to write a new abstract class, like this:

public abstract class HelloWorldABC{
    public abstrict void sayHelloWorld();
}

and create two subclasses:

public class HelloWorldSingleLine extend HelloworldABC{
    public void sayHelloWorld(){
        System.out.println("Hello World");
    }
}

in the main class, express instances of the two classes and then run their sayHelloWorld methods.
Hope this would help you write a better program!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions