-
What is the output of this program?
interface calculation
{
void calculate(int Num);
}
class display implements calculation
{
int p;
public void calculate(int Num)
{
p = Num * Num;
}
}
public class interfaces_Example
{
public static void main(String args[])
{
display object = new display();
object.p = 0;
object.calculate(4);
System.out.print(object.p);
}
}
-
- 0
- 4
- 16
- Compilation Error
- Runtime Error
Correct Option: C
16