Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.mycompany.app2;
- /**
- *
- * @author Admin
- */
- public class MyTask implements Runnable {
- private int n;
- private int m;
- public MyTask(int n, int m) {
- this.n = n;
- this.m = m;
- }
- @Override
- public void run() {
- int s = 0;
- MyFunction f = new MyFunction();
- for (int i = n; i <=m; i++) {
- s+= f.calc(i);
- }
- System.out.println(Thread.currentThread().getName() + ": s=" + s);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement