#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0

    Java errors i don't understand


    On line 21 ( public static void writeToFileAsync(final String saveState, final String fileName) { ) I receive a illegal start of expression. When I check all the curly brackets I can't see the error, or is it something else?

    Code:
    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package Games.utilities;
    /**
     *
     * @author Danny
     */
    public class FileManager {
        
         public static void writeToFile(String saveState, String fileName) {
             //TODO: Write a string to a new file synchronously
        
        /**
         *
         * @param saveState
         * @param fileName
         */
        public static void writeToFileAsync(final String saveState, final String fileName) {
            //TODO: Write a string to a new file asynchronously
            
          new Thread() {
    @Override
    public void run() {
    writeToFile(saveState, fileName); }
    }.start();
    
    }
    };
       
            }
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Location
    The Pleiades
    Posts
    294
    Rep Power
    8
    Good morning,

    This is the JavaSCRIPT section.

    Regards,

    NM.
  4. #3
  5. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2004
    Location
    Mobile, Alabama
    Posts
    4,020
    Rep Power
    1285
    Look at this

    Code:
    public static void writeToFile(String saveState, String fileName) {
             //TODO: Write a string to a new file synchronously
        
        /**
         *
         * @param saveState
         * @param fileName
         */
        public static void writeToFileAsync(final String saveState, final Strin
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0
    I don't understand what you mean. Both say the same thing except for the words final in the last part. Will you explain what you are referencing here please Do you want to see the main board?
  8. #5
  9. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2004
    Location
    Mobile, Alabama
    Posts
    4,020
    Rep Power
    1285
    Originally Posted by danbwater
    I don't understand what you mean. Both say the same thing except for the words final in the last part. Will you explain what you are referencing here please Do you want to see the main board?
    You can't put a method inside a method.
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0
    can you explain how to rewrite what I have.
  12. #7
  13. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2004
    Location
    Mobile, Alabama
    Posts
    4,020
    Rep Power
    1285
    Originally Posted by danbwater
    can you explain how to rewrite what I have.
    Make sure you end the first method before you start the second.
    Last edited by bullet; October 9th, 2013 at 11:16 AM.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0
    Thank you for your time.

IMN logo majestic logo threadwatch logo seochat tools logo