填空题
下列程序的功能是显示用户在命令行方式下指定的任意驱动器目录,请补充程序。
import java.iO.*;
public class FindDirectories
{
public static void main (String args[ ])
{
if(args.length= =0)
args=new String[ ]".."};
try
{
File pathName=new File(args [0]);
String[]fileName=pathName.list( );
for(int i=0;<fileName.length;i+ +=
{
File f=new 【 】
if(f.isDirectory( ))
{
System.out.println(f.getCanonicalPath( ));
main(new String[ ]
{
f.getPath( )
});
}
}
=
catch(IOException e)
{
e.printStackTrace( );
}
=
=
【参考答案】
File(pathName.getPath( ),fileName[i])