Results 1 to 4 of 4

Thread: File handling

  1. #1
    Dayanand is offline Member
    Join Date
    Feb 2011
    Posts
    61
    Rep Power
    0

    Default File handling

    package first;

    import java.io.File;
    import java.io.IOException;

    public class Mgr
    {
    public static void main(String[] args)
    {
    File file1 = new File("hello.html");
    try
    {
    System.out.println(file1.createNewFile());
    }
    catch (IOException e)
    {
    e.printStackTrace();
    }
    }
    }

    Hi,
    has i am very new to the topic FILE-HANDLING
    when i run the above program for the 1st time i got output true..........,but when i run the program for the second time i got the output false


    i know y i got false for the 2nd time................................!!!!!!!!!!!!
    my doubt is that "where the newly created file is stored."

    Thanks & regards
    Daya

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    You can figure this out with the following line
    Java Code:
    System.out.println(file1.getAbsolutePath());

  3. #3
    Dayanand is offline Member
    Join Date
    Feb 2011
    Posts
    61
    Rep Power
    0

    Default

    Quote Originally Posted by sunde887 View Post
    You can figure this out with the following line
    Java Code:
    System.out.println(file1.getAbsolutePath());
    ok fine,thanks for your valuable solution

    but the file which i created is there in the folder, but it is not showing in the eclipse path.?

  4. #4
    subith86 is offline Senior Member
    Join Date
    Jan 2011
    Location
    Bangalore, India
    Posts
    102
    Rep Power
    0

    Default

    Quote Originally Posted by Dayanand View Post
    but the file which i created is there in the folder, but it is not showing in the eclipse path.?
    Do you mean you want this file to be visible in your eclipse file hierarchy in the navigator?
    Then do a refresh...

Similar Threads

  1. File handling
    By Claude2005 in forum New To Java
    Replies: 17
    Last Post: 09-21-2010, 12:49 PM
  2. Java/OS File Handling
    By Revenna in forum New To Java
    Replies: 3
    Last Post: 05-04-2010, 11:08 AM
  3. Regarding File Handling
    By ravjot28 in forum New To Java
    Replies: 1
    Last Post: 01-20-2010, 10:15 PM
  4. file handling problem
    By gcampton in forum Eclipse
    Replies: 19
    Last Post: 01-05-2010, 02:18 PM
  5. handling WAV file
    By zellazode in forum New To Java
    Replies: 1
    Last Post: 09-08-2009, 04:46 PM

Posting Permissions

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