how to call abstract class with new oin java code example
Example 1: abstract class example in java
abstract class Animal{
public abstract void sound();
}
public class Dog extends Animal{
public void sound(){
System.out.println("Woof");
}
public static void main(String args[]){
Animal obj = new Dog();
obj.sound();
}
}
Example 2: how to create an abstract method in java
abstract class Scratch{
abstract public void hello();
abstract String randNum();
}
interface Other{
public void bye();
String randDouble();
}
Example 3: how to create an abstract class in java
abstract class scratch{
}