接口声明有点不明,大家帮忙
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();这句话不明白是什么意思