Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- class MySafeList extends ArrayList<Double>{
- static ArrayList<Double> mySafeList;
- public void add(Double d){
- mySafeList.add(d);
- }
- public int size(){
- return mySafeList.size();
- }
- public double get(int i){
- mySafeList.get(i);
- }
- static boolean stressTest(int n, int m){
- Thread threads[] = new Thread[n];
- try{
- for(i=0; i=n; i++){
- Thread t[i] = new Thread(new ThreadTest(1));
- t[i].start();
- for(j=0; j=m;j++){
- mySafeList.add(j);
- }
- }
- if (mySafeList.size() != n*m){
- return False;
- }
- }catch(Exception e){
- return False;
- }
- }
- public static void main(String[] args) {
- MySafeList safeList = new MySafeList();
- safeList.stressTest(2,4);
- }
- }
- C:UsersantoiDocumentsProgrammingJulienTD6_multi_threading>javac MySafeList.java
- MySafeList.java:23: error: ']' expected
- Thread t[i] = new Thread(new ThreadTest(1));
- ^
- MySafeList.java:23: error: ';' expected
- Thread t[i] = new Thread(new ThreadTest(1));
- ^
- 2 errors
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement