Results 1 to 3 of 3
Thread: Help me fix this plz!
- 11-30-2012, 09:53 AM #1
Member
- Join Date
- Nov 2012
- Posts
- 1
- Rep Power
- 0
Help me fix this plz!
The part where I wrote "the problem is here" tells me that there is no identifier...
Please help me fix this!!
I have spent a few days now on this sole problem... (I do it on my very rare freetime)
Thanks in advance!
Java Code:package delete.file.or.dir; import java.io.*; public class DeleteFileOrDir{ public static void main (String [] args){ // Directory in question File file = new File("C://123"); long fileSize = file.length(); //Directory size System.out.println("File size in bytes is: " + fileSize); System.out.println("File size in KB is : " + (double)fileSize/1024); System.out.println("File size in MB is :" + (double)fileSize/(1024*1024)); //Delete Directory with files deleteDirectory(new File("C://123")); } static public boolean deleteDirectory(File path) { if( path.exists() ) { File[] files = path.listFiles(); for(int i=0; i<files.length; i++) { if(files[i].isDirectory()) { deleteDirectory(files[i]); } else { files[i].delete(); } } } return( path.delete() ); // Create new directory } public class Create{ //the problem is here public static void(string[] args){ File dir= new File("C://123"); boolean isDirectoryCreated = dir.mkdir(); if(isDirectoryCreated) System.out.println("Reset"); else System.out.println("Error"); } } }
- 11-30-2012, 10:08 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
Re: Help me fix this plz!
You forgot the name of the method; probably you wanted to write: 'public static void main(String[] args) {'.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 11-30-2012, 01:32 PM #3
Re: Help me fix this plz!
Please go through the Forum Rules -- particularly the third paragraph.
dbWhy do they call it rush hour when nothing moves? - Robin Williams


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks