|
-
May 20th, 2001, 02:13 PM
#1
Thread Starter
Dazed Member
code needs a quick look =C)
Does anyone know why i would be an error would be generated
from this code. I keep getting:
static public String createFile(){
^
missing return statement.
I dont understand, im returning a String? I should be able to invoke a method from within a constructor call right???
import java.io.*;
class fileTest{
public static void main(String[] args){
try{
FileOutputStream fout = new FileOutputStream(createFile());
}catch(IOException e){System.err.println(e);}
} // end main
static public String createFile(){
File f = new File("C:\tempfile.txt");
try{
f.createNewFile();
String filename = f.getName();
return filename;
}catch(IOException e){System.err.println(e);}
}
} // end class
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|