Results 1 to 2 of 2
  1. #1
    gbonecapone is offline Member
    Join Date
    May 2013
    Posts
    68
    Blog Entries
    1
    Rep Power
    0

    Default Unreachable statement. please take a look.

    Im having quite a annoying problem with my program and was wondering if you guys could help me out and give me some advice. I keep getting this unreachable error in my GUI when i try to refer a string from a text box in order to make a file name out of the string type.

    take a look please. this is at the bottom of my gui. my text box refers to the method but i can't seem to figure out why it wont send over the name.


    private void job(String jobs) {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    File newFile = new File(jobs,".txt"); <<<<<<<<<<<<<<ERROR HERE!!!!!!!!!!

    try{
    newFile.createNewFile();
    }
    catch (Exception e)
    {
    }
    try
    {
    FileWriter fileW = new FileWriter(newFile);
    try (BufferedWriter buffW = new BufferedWriter(fileW)) {
    buffW.write("this is cool.");
    buffW.newLine();
    buffW.write("yea man");
    }
    System.out.println("file written");
    }
    catch (Exception e)
    {}


    }
    ----------------------------------

    here is my text area
    private void jobNumberActionPerformed(java.awt.event.ActionEven t evt) {
    String jobs = jobNumber.getText();
    job(jobs);

    }

    please help.

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,448
    Rep Power
    18

    Default Re: Unreachable statement. please take a look.

    You're throwing an exception on the very first line of your method.
    Consequently no line after that is reachable.
    Please do not ask for code as refusal often offends.

Similar Threads

  1. Unreachable statement???
    By dangolf in forum New To Java
    Replies: 5
    Last Post: 02-12-2013, 10:55 AM
  2. Replies: 2
    Last Post: 03-26-2012, 04:27 PM
  3. Strange unreachable statement error...
    By silafirion in forum New To Java
    Replies: 5
    Last Post: 12-11-2010, 05:05 AM
  4. Unreachable statement
    By lala in forum New To Java
    Replies: 3
    Last Post: 11-25-2010, 03:32 PM
  5. Unreachable statement Pig Dice Game
    By noturn10 in forum New To Java
    Replies: 2
    Last Post: 11-22-2009, 12:36 AM

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
  •