• 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

I / O

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Reading one line of data at a time from a socket connected to the network
with an input stream object s. The output to be in standard ASCII character
encoding.
(a)DataInputStream da = DataInputStream(s.getInputStream());
(b)DataInputStream do = DataInputStream(FileInputStream(g.getInputStream());
(c)BufferedReader b= new BufferedReader
(newInputStreamReader(s.getInputStreamReader));
(d)BufferedReader b= new BufferedReader
(newInputStreamReader(s.getInputStreamReader), "8859_1");

2. what is the correct format of reading a line of
String objects ??
a) FileInputStream fis = new
FileInputStream("Filename.txt");
b) DataInputStream dis = new DataInputStream(new
FileInputSTream("FileName.txt"));
c) DataInputStream dis = new DataInputStream(new
FileInputSTream("FileName.txt"), "r");
Pls help?
Thanks You
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Charlton,
I think the first question has a mistake:
the s is a reference to a Socket object. I think the option a) is right.
 
reply
    Bookmark Topic Watch Topic
  • New Topic