Author | Topic: two from Hunt's |
Indy greenhorn |
posted April 25, 2000 12:29 PM
These two questions are all from John Hunt. 47. Which of the following illustate how an InputStreamReader can be created. A. new InputStreamReader(new FileInputStream("data")); the answer is A.&E. I selected B instead of A. High-level reader receives args of low-level reader--that's what I am thinking about this. Please correct me. And, how much are we supposed to know about I/O for exam? I have a anonymous test including several questions about files, dircetory, which are driving me crazy. 63. In the answer, "the program prints out "The end" and nothing else. I can't figure out why "Done the test" isn't printed out.
|
Tony Alicea sheriff |
posted April 25, 2000 07:10 PM
47. Which of the following illustate how an InputStreamReader can be created. The question is essentially what can make a Reader out of a Stream. A is True. Almost self-explanatory. B is already a Reader C Not a valid constructor for BR. D invalid argument E Yes because Systen.in is an InputStream (check the API).
|
maha anna bartender |
posted April 26, 2000 12:13 AM
Indy, For your first qstn, InputStreamReader class is just designed for reading from an InputStream rather than a reader . It takes only InputStream as an argument for its constructor. So the answer b) which takes a FileReader as arg to its constructor will not compile at all. This is the Reader class which reads from a low level InputStream. And simillarly 'OutputStreamWriter' also behaves like this. It writes to a OutputStream rather than a Writer. So the 2nd ans is invalid. Regarding the qstn 63) I see the something slightly different from what u posted here.
regds maha anna [This message has been edited by maha anna (edited April 26, 2000).]
|
Indy greenhorn |
posted April 26, 2000 09:36 AM
Thank you very much. How tricky. I need to sharpen my eyes by more practicing. Indy
|
| | |