• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

returning bufferedreader

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a method that creates a bufferedreader and it suppose to return it to the calling class.

However I am having issues.



The method is held in what I call the DatabaseUtil class, in the final version of the program I will be connecting to a SQL database until then I am using a simple flatfile. So I want to keep connections, query, and linereading in the class. However I want the Factory to be able to loop through the fields that are returned

How can I get this to compile. The try block is hanging me up.
 
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No guarantee in this reply, just re-learning Java, but it looks like your method should be returning a BufferedReader, yet you return a string. I guess you should be returning the BufferedReader instead.

Apologies if I'm wrong.

Mike
 
Michael Hildner
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Duh, that wasn't right. You're assigning msgString to a BufferedReader, but how is msgString declared? What's the compiler message? Should be a BufferedReader?
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I get this to compile. The try block is hanging me up.

How so? Are you getting an error message? If so, what is it?
 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic