• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Convert to BufferedReader & StringTokenizor...

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm trying to convert the file below to utilize BufferedReader & SringTokenizor.... the exact instructions in my textbook were..

"so that it reads a line as a string in a BufferedReader stream, and then uses StringTokenizor to extract the fields"

I'm having a bit of trouble getting it to go... I've tried to reference a few examples and I thought I was onto it but I must have messed up something.

As you can see I commented out the code that was there and I inserted some lines of code tagged as //added or //editted... its erroring on this line way at the bottom.....

if (infile != null) infile.close();//editted

Does anyone know what I did wrong or if I am thusfar on the right track?? (I think I am, I think)........ any comments/suggestions/help/or references would be appreciated. Thank you.



[ June 14, 2004: Message edited by: Rob James ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this working code if you need a StringTokenizer. I suppose StreamTokenizer was a typo?

 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
moving this to the intermediate forum.

Please be careful that you don't do someone's homework for them out-right -- offer suggestions and pointers, and point out mistakes, but don't just code it for them. Thanks!
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic