Results 1 to 3 of 3
  1. #1
    reyey2 is offline Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Default 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");
           
        }
    }
            
          
      
        
    }

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,725
    Blog Entries
    7
    Rep Power
    21

    Default 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,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: Help me fix this plz!

    Please go through the Forum Rules -- particularly the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •