Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class NewThread implements Runnable {
- Thread t;
- NewThread(){
- t = new Thread(this,"My new Thread");
- }
- }
- class MyClass implements Runnable {
- private final Integer value;
- MyClass() {
- new Thread(this);
- int i = 0;
- value = Integer.valueOf(20 / i);
- }
- @Override
- public void run() {
- System.out.println(value.intValue());
- }
- }
- class MyClass implements Runnable {
- ...
- MyClass start() {
- new Thread(this);
- return this;
- }
- ...
- }
- // Then construct like this:
- MyClass foo = new MyClass().start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement