Advertisement
Guest User

Untitled

a guest
May 31st, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. public class Mix4 {
  2.  
  3.     int counter = 0;
  4.  
  5.     public static void main(String[] args){
  6.         int count = 0;
  7.  
  8.         Mix4 [] m4a = new Mix4[20];
  9.         int x = 0;
  10.  
  11.         while( x < 20 ){
  12.             m4a[x] = new Mix4();
  13.  
  14.             m4a[x].counter = m4a[x].counter + 1;
  15.             count = count + 1;
  16.             count = count + m4a[x].maybeNew(x);
  17.             x = x + 1;
  18.  
  19.  
  20.         }
  21.         System.out.println(count + " " + m4a[1].counter);
  22.  
  23.     }
  24.  
  25.     public int maybeNew(int index){
  26.         if (index < 5){
  27.             Mix4 m4 = new Mix4();
  28.             m4.counter = m4.counter + 1;
  29.             return 1;
  30.         }
  31.         return 0;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement