How to make System.out.println() shorter

后端 未结 12 1033
伪装坚强ぢ
伪装坚强ぢ 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:32

    A minor point perhaps, but:

    import static System.out;
    
    public class Tester
    {
        public static void main(String[] args)
        {
            out.println("Hello!"); 
        }
    }
    

    ...generated a compile time error. I corrected the error by editing the first line to read:

    import static java.lang.System.out;
    

提交回复
热议问题