aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes scjp (DataInputStream) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "scjp (DataInputStream)" Watch "scjp (DataInputStream)" New topic
Author

scjp (DataInputStream)

Sham Grandhe
Ranch Hand

Joined: Dec 16, 2003
Posts: 73
54. Which of the following will compile without error?
A) File f = new File("/","autoexec.bat");
B) DataInputStream d = new DataInputStream(System.in);
C) OutputStreamWriter o = new OutputStreamWriter(System.out);
D) RandomAccessFile r = new RandomAccessFile("OutFile");
can a datainputstream take the system.in as an parameter, the datainputstream is high level, so it needs lowlevel stream, plz make this clear
shyam
[ Jess added a more descriptive title ]
[ January 22, 2004: Message edited by: Jessica Sant ]
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
A DataInputStream is constructed with an InputStream object.
System.in is a BufferedInputStream, which extends FilterInputStream, which extends InputStream.
Therefore, System.in 'is-a' InputStream and can be used as a constructor argument for DataInputStream.
Sham Grandhe
Ranch Hand

Joined: Dec 16, 2003
Posts: 73
hai Ray Stojonic,
thank you fr the kind information, I've been given the exact informaion that Ineed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: scjp (DataInputStream)
 
Similar Threads
Valid???
Quession obout I/O
DataInputstream
I/0 Quession
Input stream object