【问题标题】:How do I invoke a method without parameters?如何调用没有参数的方法?
【发布时间】:2014-02-13 10:15:23
【问题描述】:
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 方法中调用的方法。不带参数怎么调用?

【问题讨论】:

  • 只需调用 rainbows();
  • 我想知道你是否知道如何调用方法with参数。都是一样的,唯一的区别是with or without parameter
  • 我是大学二年级学生。这个问题现在我的帐户被禁止了....

标签: java methods parameters call invoke


【解决方案1】:
public class MyClass {
    public static void main(final String[] args) {
        rainbows();
    }

    // your method here
}

【讨论】:

    猜你喜欢
    • 2016-07-11
    • 1970-01-01
    • 2018-05-16
    • 2018-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多