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!
As title says, the two classes take the same function. I recommend you to write a new abstract class, like this:
and create two subclasses:
in the main class, express instances of the two classes and then run their
sayHelloWorldmethods.Hope this would help you write a better program!