标题:接口声明有点不明,大家帮忙
取消只看楼主
陈梦林
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-5-18
 问题点数:0 回复次数:0 
接口声明有点不明,大家帮忙
import java.lang.*;
interface ToolSpeed
{
    public double speed(double a,double b,double c);
}

   
class  Car007 implements ToolSpeed
{
        public double speed(double a,double b,double c)
    {
        return a*b/c;
    }
}
class Plane implements ToolSpeed
{
    public double speed(double a,double b,double c)
    {
        return a+b+c;
    }
}
public class ComputeTime
{
    public static void main(String args[])
    {
        try
        {
        ToolSpeed   ts=(ToolSpeed)Class.forName(args[0]).newInstance();
        double a=Double.parseDouble(args[1]);
        double b=Double.parseDouble(args[2]);
        double c=Double.parseDouble(args[3]);
        System.out.println("the time is "+1000/ts.speed(a,b,c));
        System.out.println("\n");
        }
              catch(Exception e)
                {
                 System.out.println("class not found");
           }
        
    }
}
ToolSpeed   ts=(ToolSpeed)Class.forName(args[0]).newInstance();这句话不明白是什么意思
搜索更多相关主题的帖子: 接口 声明 
2008-10-11 00:28



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-237544-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.433402 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved