jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Input/Output(urgent) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Input/Output(urgent)" Watch "Input/Output(urgent)" New topic


Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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
(a)DataInputStream da = DataInputStream(s.getInputStream());
(b)DataInputStream do = DataInputStream(FileInputStream(g.getInputStream());
(c)BufferedReader b= new BufferedReader
(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
b) DataInputStream dis = new DataInputStream(new
c) DataInputStream dis = new DataInputStream(new
FileInputSTream("FileName.txt"), "r");
Can anyone help me.
kishore kota

Joined: Sep 23, 2000
Posts: 5
hai peter ,
for the 1st queswtion as per my knowledge the ans should contain the ASCII code as the last argument in the constructer so the ans
may be 'd'
hope this will help u,
if wrong correct me
Kishan Kumar
Ranch Hand

Joined: Sep 26, 2000
Posts: 130
b is the correct answer.
d would have been correct if the arguments were passed correct.
BufferedReader b= new BufferedReader
(newInputStreamReader(s.getInputStreamReader), "8859_1");
the "8859_1" String parameter should be in the constructor of
2. b is the correct answer
This question is asked by Janani, and eplanation is given for
this in that post.
I am a buddy to this group and can I know what "green horn"

Regards,<BR>V. Kishan Kumar
scott irwin
Ranch Hand

Joined: Aug 07, 2000
Posts: 87
1) A is correct. Because the stream is said to be standard ASCII encoding we don't need a Reader(?). Only A has a valid constructor. In B, FileInputStream doesn't take an InputStream, only String, File and FileDescriptor.
2) If the FileInputSTream is a typo (FileInputStream) then B is correct, otherwise none.
I agree. Here's the link: http://aspose.com/file-tools
subject: Input/Output(urgent)
It's not a secret anymore!