5+

来自「本压缩文档为《Java大学实用教程》(7-121-00959-5 电子工业出版社」· 代码 · 共 40 行

TXT
40
字号
interface Computable 
{  
    final int MAX=100;
    int f(int x);
    public abstract int g(int x,int y);
}
class A implements Computable 
{
    public int f(int x)
    {
       return x*x;
    } 
   public int g(int x,int y)
    {
       return x+y;
    }
}
class B implements Computable 
{
    public int f(int x)         
    {
       return x*x*x;
    } 
   public int g(int x,int y)
    {
       return x*y;
    }
}
public class Example
{ 
    public static void main(String args[]) 
    {
       A a=new A();
       B b=new B();
       System.out.println(a.MAX);
       System.out.println(""+a.f(10)+" "+a.g(12,2));
       System.out.println(b.MAX);
       System.out.println(""+b.f(10)+" "+b.g(12,2));
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?