Java Reference
In-Depth Information
Quiz
Review today's material by taking this three-question quiz.
Questions
1. Which of the following is not an advantage of the new java.nio package and its
related packages?
a. Large amounts of data can be manipulated quickly with buffers.
b. Networking connections can be nonblocking for more reliable use in your
applications.
c. Streams are no longer necessary to read and write data over a network.
2. In the finger protocol, which program makes a request for information about a
user?
a. The client
b. The server
c. Both can make that request.
3. Which method is preferred for loading the data from a web page into your Java
application?
a. Creating a Socket and an input stream from that socket
b. Creating a URL and an HttpURLConnection from that object
c. Loading the page using the method toString()
Answers
1. c. The java.nio classes work in conjunction with streams. They don't replace
them entirely.
2. a. The client requests information, and the server sends something back in
response. This is traditionally how client/server applications function, although
some programs can act as both client and server.
3. b. Sockets are good for low-level connections, such as when you are implementing
a new protocol. For existing protocols such as HTTP, there are classes better suited
to that protocol— URL and HttpURLConnection , in this case.
 
Search WWH ::




Custom Search