All pastes #524495 Raw Edit

Mine

public java v1 · immutable
#524495 ·published 2007-05-31 02:57 UTC
rendered paste body
Class MyProgram {    Class Unit {      public int hitPoints;      public int penisLength;      public Unit(String type) {         if (type.equals("fighter")) {            hitPoints   = 100;            penisLength = 100;         } else if (type.equals("medic")) {            hitPoints   = 80;            penisLength = 80;         } else {            hitPoints   = 50;            penisLength = 50;         }      }      public getsHurt(int damage) {         hitPoints = hitPoints - damage;      }   }    static void main() {      Unit[] myFighters  = new Unit[100];  // create 100 fighters  (array of units)      Unit[] myMedics    = new Unit[100];  // create 100 medics    (array of units)      Unit[] mySorcerers = new Unit[100];  // create 100 sorcerers (array of units)      for (int i = 0; i < 100; i++)         myFighters[i] = new Unit("fighter");    // create the individual objects      for (int i = 0; i < 100; i++)         myMedics[i] = new Unit("medic");        // create the individual objects      for (int i = 0; i < 100; i++)         mySorcerers[i] = new Unit("sorcerer");  // create the individual objects            // Some fight happens and hurts just fighter number 22      myFighters[22].getsHurt(90);            // Now fighter number 22 has 10 hitpoints, but all the other fighters      // still have 100            // Some fight happens and hurts all the fighters      for (int i = 0; i < 100; i++)         myFighters[i].getsHurt(10);      // Now fighter number 22 has 0 hitpoints, and all the other fighters      // have 90      // All the medics and sorcerers still have whatever they started with      return;   } }