print current date in java

后端 未结 9 1830
半阙折子戏
半阙折子戏 2020-12-18 19:38

I want to print current date and time in java..This is the code I am trying from a java tutorial:

import java.util.*;
  
public class Date {
   public static          


        
9条回答
  •  被撕碎了的回忆
    2020-12-18 20:25

    Your class is a custom class that is producing the output given by Object.toString. Rename the class to something else other than Date so that java.util.Date is correctly imported

提交回复
热议问题