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 5 of 5

Thread: Java PhoneBook

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java PhoneBook

    Hey Guys,

    My Program was going great... I had to make a Java Phonebook that reads in Firstname Secondname and Phone numer and output them alphabetically in the format Secondname, Firstname Phonenumber.
    I can get this is work perfectly, but we have to be able to cater for 1000 inputs. I cant get the program to do this, if I use while loops nothing happens, if i use if loops, again nothing happens, So basically I was wondering if anyone could give me any help at all as to why I cant get it to stop?
    Thanks

    Heres my code
    Last edited by Sparky; April 5th, 2011 at 11:46 AM.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,385
    My Mood
    Hungover
    Thanks
    144
    Thanked 628 Times in 538 Posts

    Default Re: Java PhoneBook

    Where is this Console.readToken() method? I can't seem to find it in the standard APIs.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Apr 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java PhoneBook

    Quote Originally Posted by KevinWorkman View Post
    Where is this Console.readToken() method? I can't seem to find it in the standard APIs.
    Thanks for your reply!
    We use our own Console.class file.... Console.readToken(); reads in the next word.
    I can get the program to work if I set the number of people I want to enter and then enter them, but If i set it to 1000, i cant get it to stop?

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,385
    My Mood
    Hungover
    Thanks
    144
    Thanked 628 Times in 538 Posts

    Default Re: Java PhoneBook

    Okay, I understand now. It appears that your if(finish.equals("")) never evaluates to true. I can't test it out without an SSCCE, but try throwing in some print statements (or better yet, using a debugger) to figure out what's going on.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: Java PhoneBook

    Have you removed the code?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

Similar Threads

  1. Question about writing a phonebook sorting program
    By Stockholm Syndrome in forum Java Theory & Questions
    Replies: 2
    Last Post: March 25th, 2011, 09:25 AM
  2. Replies: 1
    Last Post: May 8th, 2009, 08:55 AM
  3. Create Phonebook using inheritance
    By islandGirl in forum Object Oriented Programming
    Replies: 5
    Last Post: February 17th, 2009, 03:42 AM