How to make System.out.println() shorter

后端 未结 12 1020
伪装坚强ぢ
伪装坚强ぢ 2020-12-04 07:10

Please advice on where can I find the lib in order to use the shorter expression of System.out.println() and where should I place that lib.

12条回答
  •  臣服心动
    2020-12-04 07:25

    package some.useful.methods;
    
    public class B {
    
        public static void p(Object s){
            System.out.println(s);
        }
    }
    package first.java.lesson;
    
    import static some.useful.methods.B.*;
    
    public class A {
    
        public static void main(String[] args) {
    
            p("Hello!");
    
        }
    }

提交回复
热议问题