File: Main.java
import java.io.PrintStream;
public class Main {
public static void main(String[] a) {
MessageData source = new MessageData("Hello, world");
MessageReporter destination = new MessageReporter();
destination.write(System.out, source.getMessage());
}
}
final class MessageData {
private final String message;
public MessageData(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
}
class MessageReporter {
public void write(PrintStream out, String message) {
out.println(message);
}
}
|