What is the difference between java.lang.Void and void?

前端 未结 6 555
心在旅途
心在旅途 2020-11-29 03:27

In API

\"The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void.\"

6条回答
  •  伪装坚强ぢ
    2020-11-29 04:01

    Another example for using Void is SwingWorker

    new SwingWorker () {
        @Override
        protected Void doInBackground(){
            ...
        }
        @Override
        protected void process(List chunk){
            ...
        }
        @Override
        public void done(){
            ...
        }
    }.execute();
    

提交回复
热议问题