MyTask.java Source code

Java tutorial

Introduction

Here is the source code for MyTask.java

Source

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.TimerTask;

class MyTask extends TimerTask {
    private DataOutputStream out;

    public MyTask(OutputStream dest) {
        out = new DataOutputStream(dest);
    }

    public void run() {
        try {
            out.writeInt(1);
            out.writeUTF("asdf");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}