the first is :
I have a variable "root" that the type is "File" and I want to convert "File" to "String".
so it must be like that:
String path = (String) root + fileNames[i].getName();
so how can I change the type of "root"?
the second is :
I have imported all this libraries :
import java.util.*;
import java.io.*;
import java.nio.*;
import java.lang.*;
import java.*;
but I have like error :
symbol : method isDirectory()
location: class java.lang.String
if ( fileNames[i].isDirectory()) {
symbol : method getName()
location: class java.lang.String
String path = root + fileNames[i].getName()
it don't know the methods getName() and isDirectory()
2007-05-09
02:33:37
·
2 answers
·
asked by
Sepehr
2
in
Computers & Internet
➔ Programming & Design
the first problem has resolve by Jim Mary
the response was the methode toString.
but the second is not resolve.
2007-05-09
03:07:25 ·
update #1
the second problem has resolve.
the solution was the type of "fileNames" because the type was String and isDirectory() and getName() are the methodes of type File.
2007-05-09
03:45:19 ·
update #2
I have a third question:
I have like error message this one:
Exception in thread "main" java.lang.NullPointerException
at frag.Main.main(Main.java:41)
and the code is :
................
int inode=0;
try {
fs=frag.FileSystem.getInstance(3);
}
catch(IOException exception) {
System.out.println("IOexception");
fs=null;
}
map=new CompleteMemoryMap(4096);
newMap=new CompleteMemoryMap(4096);
Vector files=fs.getRemixFiles();
Iterator list=files.iterator();
while (list.hasNext()) {
RemixFile rf;
rf=list.next();
map.add(rf.getFileMap());
newMap.add(rf.getFileMap());
}
.......
what can I do?
2007-05-09
03:48:21 ·
update #3