Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to use an abstract class in java

interface methods{
    public void hey();
    public void bye();
}

//unable to implement all the abstract methods in the interface so 
// the other class automatically becomes abstract
abstract class other implements methods{
    public void hey(){
        System.out.println("Hey");
    }
}

//able to implement all the methods so is not abstract
class scratch implements methods {
    public void hey(){
        System.out.println("Hey");
    }
    public void bye() {
        System.out.println("Hey");
    }
}
Source by www.java67.com #
 
PREVIOUS NEXT
Tagged: #abstract #class #java
ADD COMMENT
Topic
Name
7+3 =