+/EE360P

distributed systems

git clone https://git.julia.blue/+/EE360P

Wei-Lun Hungupdate name828c852

master
705 B29 linesraw
1class Foo {
2    String name;
3    public Foo(String s) {
4        name = s;
5    }
6    public void setName(String s) {
7        name = s;
8    }
9    public String getName() {
10        return name;
11    }
12}
13class FooBar extends Foo implements Runnable {
14    public FooBar(String s) {
15        super(s);
16    }
17    public void run() {
18        for (int i = 0; i < 10; i++)
19            System.out.println(getName() + ": Hello World");
20    }
21    public static void main(String[] args) {
22        FooBar f1 = new FooBar("Romeo");
23        Thread t1 = new Thread(f1);
24        t1.start();
25        FooBar f2 = new FooBar("Juliet");
26        Thread t2 = new Thread(f2);
27        t2.start();
28    }
29}