Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: java.io.File;

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Location
    Philippines
    Posts
    19
    My Mood
    Dead
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question java.io.File;

    Can someone help me about my system. Im having trouble about my code. I cant figure out how it works. Lets see. Soo its about File class. How am i be able to compare string to notepad data. I've tried this code:

    While(inFile.hasNext()){

    Record = inFile.hasNextLin();

    If(inFile.hasNext()){
    inFile.nextLine();

    If(id.equals(inFile.next()){
    System.out.print(record);

    }

    Else{
    Store.add(record);


    }



    }


    }



    My problem is, the user should enter an existing ID. And when it matches to the ID from the notepad, it will be deleted ..


    Notepad information:

    1#Zsannen Smile#First Year#
    2#Number Sign#Second Year#



    *the delimiter is "#"
    *if i enter 1 for the ID, all the information of number 1 will be deleted.



    Thank You for the future help.
    Looking forward for someone who will help me. i can explain more about my problem if you insisted.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,571
    Thanks
    49
    Thanked 2,232 Times in 2,204 Posts

    Default Re: java.io.File;

    Please post enough code so that all the variables used in the post are defined. For example inFile is not defined.

    How am i be able to compare string
    Read a line from the file into a String and use the equals() method.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Apr 2013
    Location
    Philippines
    Posts
    19
    My Mood
    Dead
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: java.io.File;

    alright. i posted a new one. please check that out. thank you so much for the help.

    this is the link. thanks.
    What's wrong with my code :(

Similar Threads

  1. Replies: 19
    Last Post: March 15th, 2013, 03:11 PM
  2. Reading a file and comparing them to an array to get the file type - java
    By tomb1992 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: March 4th, 2013, 05:13 PM
  3. Java I/O File code; how to read/write file
    By ryu2le in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: September 18th, 2011, 05:51 PM
  4. Replies: 10
    Last Post: January 12th, 2011, 04:48 AM
  5. insert(embed) a file object (.txt file) in MS excel sheet using java.
    By jyoti.dce in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 12th, 2010, 08:16 AM

Tags for this Thread