HeapUser.java revision 0
6443N/A/*
6443N/A * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
6443N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6443N/A *
6443N/A * This code is free software; you can redistribute it and/or modify it
6443N/A * under the terms of the GNU General Public License version 2 only, as
6443N/A * published by the Free Software Foundation.
6443N/A *
6443N/A * This code is distributed in the hope that it will be useful, but WITHOUT
6443N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6443N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6443N/A * version 2 for more details (a copy is included in the LICENSE file that
6443N/A * accompanied this code).
6443N/A *
6443N/A * You should have received a copy of the GNU General Public License version
6443N/A * 2 along with this work; if not, write to the Free Software Foundation,
6443N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6443N/A *
6443N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
6443N/A * CA 95054 USA or visit www.sun.com if you need additional information or
6443N/A * have any questions.
6443N/A */
7049N/A
6443N/A
6443N/A/*
6443N/A *
6443N/A * Sample target application
6443N/A *
7049N/A */
7049N/A
7050N/Aclass Animal {
6443N/A int category;
6443N/A int age;
6443N/A}
6443N/A
6443N/Aclass Pet extends Animal {
6443N/A String owner;
6443N/A String name;
6443N/A String vet;
6443N/A String records;
6443N/A String address;
6443N/A Pet(String name) { this.name = name; }
6443N/A}
6443N/A
6443N/Aclass Dog extends Pet {
6443N/A int breed;
6443N/A int barks;
6443N/A Dog(String name) { super(name); }
6443N/A}
6443N/A
6443N/Aclass Cat extends Pet {
6443N/A int breed;
6443N/A int claws;
6443N/A Cat(String name) { super(name); }
6443N/A}
6443N/A
6443N/Apublic class HeapUser {
6443N/A private static Dog dogs[];
6443N/A private static Cat cats[];
6443N/A public static void main(String args[]) {
6443N/A System.out.println("HeapUser start, 101 dogs, 1000 cats");
6443N/A dogs = new Dog[101];
6443N/A for(int i=0; i<101; i++) {
6443N/A dogs[i] = new Dog("fido " + i);
6443N/A }
6443N/A cats = new Cat[1000];
6443N/A for(int i=0; i<1000; i++) {
6443N/A cats[i] = new Cat("feefee " + i);
6443N/A }
6443N/A System.out.println("HeapUser end");
6443N/A }
6443N/A}
6443N/A