Guest User

Untitled

a guest
Jun 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import java.util.Date;
  2.  
  3. class Thing {
  4. static Date getDate() {return new Date();}
  5. }
  6.  
  7. // not importing Date here.
  8.  
  9. public class TestUsesThing {
  10.  
  11. public static void main(String[] args) {
  12. System.out.println(Thing.getDate().getTime()); // okay
  13. // Date date = new Date(); // naturally this wouldn't be okay
  14. }
  15.  
  16. }
  17.  
  18. Date date = new Date();
  19.  
  20. Date d = new Date(); // a statement
  21.  
  22. new Thing().getDate().getTime()
  23.  
  24. Date d = new Thing().getDate();
  25.  
  26. System.out.println( new Thing().getDate().getTime() )
  27.  
  28. System.out.println( new Thing().getDate() )
  29.  
  30. public java.util.Date getDate() {
  31. return this.date;
  32. }
  33.  
  34. public Date getDate() {
Add Comment
Please, Sign In to add comment