Readers Writers   «Prev  Next»
Lesson 2 Java Readers and Writers Course Prerequisites
Objective Explore what you need to know to succeed in this course.

Java Readers and Writers Course Prerequisites

To successfully complete this course and move on to writing programs that communicate over networks, you should be comfortable with
  1. classes, objects, and methods in Java, particularly constructors and toString() methods
  2. input and output streams
  3. writing character-mode Java applications with main() methods
  4. the basics of the AWT including windows, dialog boxes, and Java 1.1 event handling

This course builds on the skills you learned in the first Networking with Java course, Java Streams.
If you did not take that course, you should still be able to successfully complete Java Readers and Writers as long as you have the prerequisite skills listed above.

The following quiz question, tests your knowledge of the Java Console class.

Which of the following statements can cause "hello" to be printed to the console? [Please select 1 option:]
  1. System.console().println("hello");
  2. System.console().writer().println("hello");
  3. System.console().message("hello");
  4. System.console().out("hello");

Answer: b
Choice B is correct. The writer() method of the Console class returns the unique PrintWriter object associated with this console. The println() method of the PrintWriter class can then be called to print to the console. Choices A, C and D are incorrect because the Console class does not define 1) println, 2) message and 3) out methods.
The correct answer is: System.console().writer().println("hello");