How to find the date of an object in Java
•
Java
Suppose I have a class named "test" and I create an instance of this class. Can I know the creation date of this instance?
Solution
You must handle it yourself by using the date instance member in the test class and initializing it in the constructor (or its declaration) with the current date
public class Test { Date date = new Date (); public Date getCreationDate () { return date; } }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码