【问题标题】:How to make out.println() method working in a simple java file without using System Class reference?如何在不使用系统类引用的情况下使 out.println() 方法在简单的 java 文件中工作?
【发布时间】:2013-07-23 21:42:38
【问题描述】:

public class ABC{ public static void main(String[] args) { out.println("Hello"); } }

【问题讨论】:

    标签: import static


    【解决方案1】:

    这很有效,尽管静态导入在 java 中通常不被认为是一件好事。

    import static java.lang.System.out;
    
    public class ABC {
        public static void main(String[] args) {
            out.println("hello");
        }
    }
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-10
    • 1970-01-01
    • 2015-10-14
    相关资源
    最近更新 更多