Java Reference
In-Depth Information
Figure 8-10. A dialog box appears when you leave the Start directory textfield empty, or when
you enter a path to a filename or a nonexistent directory in this textfield.
EXERCISES
Thefollowingexercisesaredesignedtotestyourunderstandingof File andvarious
stream and writer/reader APIs:
1. Create an application named Touch for setting a file's or directory's
timestamptothecurrentorspecifiedtime.Thisapplicationhasthefollowing
usage syntax: java Touch [-d timestamp ] pathname . If you
don't specify [-d timestamp ] , pathname 's timestamp is set to the
currenttime;otherwise,itissettothespecified timestamp value,which
has the format yyyy - MM - dd HH : mm : ss z ( 2010-08-13 02:37:45
UTC and 2006-04-22 12:35:45 EST are examples). Hints: The
java.util.Date class(whichIformallyintroduceinAppendixC)has
a getTime() method whose return value can be passed to File 's
setLastModified() method.Also,you'llfind Date date = new
 
Search WWH ::




Custom Search