public class Hacker
1:
2: /**
3: Toy program to demonstrate how a programmer can access and
4: change private data in an object of the class CadetClass.
5: */
6: public class Hacker
7: {
8: public static void main(String[] args)
9: {
10: CadetClass starFleetOfficer = new CadetClass( );
11: System.out.println("starFleetOfficer contains:");
12: starFleetOfficer.writeOutput( );
13: PetRecord badGuy;
14: badGuy = starFleetOfficer.getPet( );
15: badGuy.set("Dominion Spy", 1200, 500);
16: System.out.println("Looks like a security breach:");
17: System.out.println("starFleetOfficer now contains:");
18: starFleetOfficer.writeOutput( );
19: System.out.println("The pet wasn't so private!");
20: }
21: }