abstract method variable java example
Example 1: abstract class in java
public abstract class GraphicObject {
abstract void draw();
}
Example 2: 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 3: 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 4: how to create an abstract class in java
abstract class scratch{
}