Complete the code to declare an interface named IAnimal.
public [1] IAnimal
{
void Speak();
}The keyword interface is used to declare an interface in C#.
Complete the code to declare an interface method named Move that returns void.
public interface IVehicle
{
[1] Move();
}Interface methods specify the return type. Here, void means no value is returned.
Fix the error in the interface declaration by completing the code.
public [1] IShape
{
double GetArea();
}The correct keyword to declare an interface is interface. Using 'class' or others causes errors.
Fill both blanks to declare an interface ICalculator with a method Add that returns an int.
public [1] ICalculator { [2] Add(int a, int b); }
The interface is declared with interface keyword and the method returns an int.
Fill all three blanks to declare an interface IPrinter with a method Print that takes a string and returns void.
public [1] IPrinter { [2] Print([3] message); }
The interface uses interface keyword, the method returns void, and the parameter type is string.