Java Reference
In-Depth Information
System.out.println("writeable.");
if (fi leDir.isDirectory())
{
System.out.println("Contents:");
String[] fi leList = fi leDir.list();
//Now display list of fi les in
//directory…
for (int i=0;i<fi leList.length;i++)
System.out.println(" "
+ fi leList[i]);
}
else
{
System.out.print("Size of fi le: ");
System.out.println(fi leDir.length()
+ " bytes.");
}
System.out.print(
"\n\nEnter name of next fi le/directory ");
System.out.print(
"or press <Enter> to quit: ");
fi lename = input.nextLine();
}
input.close();
}
}
Figure 4.2 shows example output from the above program.
Search WWH ::




Custom Search