• 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

HUNT's mock exam

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which of the following correctly illustrate how an InputStreamReader can be created:
a. new InputStreamReader(new FileInputStream("data"));
b. new InputStreamReader(new FileReader("data"));
c. new InputStreamReader(new BufferedReader("data"));
d. new InputStreamReader("data");
e. new InputStreamReader(System.in);
Select all correct answers.
It says anser is A,E. I am thinking it should be B,E. Please clarify.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Class InputStreamReader constructor has the argument of type InputStream.
A is correct, because the argument here is a class/subclass of InputStream.
B is not correct because FileReader is not a class/subclass of InputStream
C is not correct because BufferedReader is not a class/subclass of InputStream
D is not correct because "data" is a string and is not a class/subclass of InputStream
E is correct because System.in is of type InputStream.
So A and E are correct.
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pilanio,
The ans. given are correct. Whenever you get qstns regarding the syntax involved in construction of a class please refer to the Java API Doc. Most of the time you will be served.
regds
maha anna

[This message has been edited by maha anna (edited April 06, 2000).]
 
reply
    Bookmark Topic Watch Topic
  • New Topic