Assignment 4 - sidramaqsood/learning GitHub Wiki

#1. What is interface? ANS. An interface is a reference type in java,is similar to class,it is a collection of abstract methods. A class implements an interface , there by inheriting the abstract method of interface. writing an interface is similar to writing a class but class describe attribute and behavior of an object.and interface contain behavior the class implement.

#2.What is abstract ? ANS. Abstract class are meant to be inherited form, and one class inherited from another, it there is strong relationship between two classes for instance,if we have an abstract class base called ''canine'', any driving class should be animal that belong to canine family. ' # Syntax Abstract class class_name{}

 Example:

 abstract class Car{

 abstract void run();

}

class Honda extends Car

{

void run()

{

System.Out.println("running very fast");

}

public static void main(String args[]){

Car obj = new Honda();

obj.run();

} }