• 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

Read everything as a String?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I've just started my developer assignment - URLyBird

Maybe I'm missing something here, but when I read the data in from the data file as bytes - How can I tell if the data read in should be treated as a string or an int etc. Granted I can hardcode this in to the code, but I guess I shouldn't do this as then the metdata/database could not be changed without modifying the code. So at the moment I'm treating everything as a String

Thanks.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at your assignment description once more. If it says "numeric data" you should read into the appropriate Java primitive. If it says otherwise the read into a String using the appropriate encoding.
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I read and store all field values as String. Since all fields are for displayed only (except the owner field which I have validate code to make sure it is numeric), I found it easilier to keep them as Strings.
 
reply
    Bookmark Topic Watch Topic
  • New Topic