我的速度方法不斷給我一個錯誤說方法重載錯誤
速度「名爲‘速度’的方法沒有適用過載型被發現‘’也許你想要過載版本「無效速度(雙距離,雙倍時間)拋出java.io.IOException;'代替?」
我不太確定我該如何解決這個問題,但如果你們能幫忙,那就太好了,謝謝。
不管怎麼說,這裏是代碼:
import java.io.*;
public class Velocity
{
public static void main (String[] args)
{
velocity();
}
public static void velocity (double distance, double time) throws IOException
{
BufferedReader myInput = new BufferedReader (new InputStreamReader (System.in));
System.out.println ("Please input distance in meters:");
distance = Double.parseDouble (myInput.readLine());
System.out.println ("Please input time in seconds:");
time = Double.parseDouble (myInput.readLine());
System.out.println ("Therefore your velocity is " + distance/time + " m/s.");
}
}
你認爲'velocity();'應該做什麼?爲什麼? – 2014-11-02 16:16:43
沒有冒犯,但它是明智的閱讀方法如何工作 – 2014-11-02 16:17:43