Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java help  RSS feed

 
Ismail Shaqiri
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am stuck on this part where it does not write to an output file

the first class is contact I had to modify


this class oes the sorting this is fine



this is he class I need help with


 
Vineeth Menon
Ranch Hand
Posts: 79
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ismail,

Welcome to the Ranch.
 
Ismail Shaqiri
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey

Thank you
 
Vineeth Menon
Ranch Hand
Posts: 79
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ismail,

I might be wrong Ismail, but I do not see you calling the printContacts method anywhere...
 
Ismail Shaqiri
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry but what is that going to do? the sort is already done and when I run it is fine. The program works fine but it wont send it to the output file which is wired
I had it working but I changed something and it wont work now which is wired.
Thank you.
 
Vineeth Menon
Ranch Hand
Posts: 79
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just after


mention if file is does not exist, create a new file in a if statement... something like this would do

if(!file.exist)
create a new file named p4output.txt
 
Ismail Shaqiri
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey VM,

Thank you so much for your help, I could not figure it out. I will submit the project the way it is. The Instructor will probably, take only a few points off. And I am curious to see what kind of dumb mistake I did.

Thank you.
 
Paul Clapham
Sheriff
Posts: 22835
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, like Vineet said, your code doesn't call the printContacts method. And since it's the printContacts method which writes data to the file, that means that no data gets written to the file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!