Syntax error on token ";", { expected after this token please HELP
Code :
import java.io.File;
public class ModDetector{
public static class Detect{
File folder = new File("c:/");
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
System.out.println("File " + listOfFiles[i].getName());
} else if (listOfFiles[i].isDirectory()) {
System.out.println("Directory " + listOfFiles[i].getName());
}
}
}
}
}
the problem is in 9th row, last token ";" plz help, quick fix no suggestions...
Re: Syntax error on token ";", { expected after this token please HELP
Which line is the 9th line?
You could have added a comment like: //<<<<<<<<<< LINE 9
Better yet, post the full text of the compiler's error message.
Re: Syntax error on token ";", { expected after this token please HELP
i believe u have an extra '}'
i dont know where but i count 5 '{' and 6 '}'
Re: Syntax error on token ";", { expected after this token please HELP
You need to put your code within the main method. There is no application start point.
Code Java:
public static void main(String args[]){
// code to execute here
}
Re: Syntax error on token ";", { expected after this token please HELP
I think this is what you intended:
You have an extra closing curly brace at the end. Apart from that it seems to me that using a static inner class is probably not what you intend. If it is -- you must create a method inside the inner class which holds the code you want to run. You must then call that method from another part of your program (i.e. the main() method).
Re: Syntax error on token ";", { expected after this token please HELP
@rektiphyr, please read the forum rules, as well as the following:
http://www.javaprogrammingforums.com...n-feeding.html
Re: Syntax error on token ";", { expected after this token please HELP
Quote:
Originally Posted by
copeg
My appologies -- I have now read and understand the forum rules. I have also edited my original post.