2014-01-23 39 views
-2
public static void rainbows() { 
    Console console = System.console(); 
    double F = Double.parseDouble(console.readLine("Enter Fahrenheit: ")); 
    System.out.print("The Degrees in Celsius is: " + ((F - 32) * (5.0/9))); 

這是我想要在我的Main方法中調用的方法。我如何在沒有參數的情況下調用它?如何調用不帶參數的方法?

+5

Just call rainbows(); –

+1

我不知道你是否知道如何用**參數調用方法**。它是一樣的,唯一的區別是_with_或_without_參數 – Baby

回答

0
public class MyClass { 
    public static void main(final String[] args) { 
     rainbows(); 
    } 

    // your method here 
}