-
Notifications
You must be signed in to change notification settings - Fork 16
[Feature] A abstract method could be created #7
Copy link
Copy link
Open
Description
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!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels