Ejemplo n.º 1
0
  public static void main(String args[]) {

    Elephant Nellie = new Elephant("Nellie");

    LinkedList<String> nellieLikes = new LinkedList<String>();

    // Try adding more than apples?
    nellieLikes.add("apples");
    // nellieLikes.add( "elephants" );

    Nellie.setLikes(nellieLikes);

    // What happens to the 'likes' print out if nellie likes more than one thing?
    System.out.println(Nellie.getName() + " likes " + Nellie.getLikes().getFirst());
    System.out.println(
        Nellie.getName() + " is an instance of " + Nellie.getClass().getSuperclass());

    // This just iterates through the superclasses of Nellie, working up the inheritance tree.
    Class cls = Nellie.getClass();
    Class oldCls = cls;
    while ((cls = cls.getSuperclass()) != null) {

      if (cls.toString().equals("class java.lang.Object")) {
        System.out.println("And in Java, every Object is an instance of " + cls);
      } else {
        System.out.println(oldCls + " is an instance of: " + cls);
      }

      oldCls = cls;
    }
  }
Ejemplo n.º 2
0
 public boolean[] bbooleanArray(boolean[] a, boolean b[]) {
   return delegate.bbooleanArray(a, b);
 }
Ejemplo n.º 3
0
 public boolean bboolean(boolean a, boolean b) {
   return delegate.bboolean(a, b);
 }
Ejemplo n.º 4
0
 public short sshort(short a, short b) {
   return delegate.sshort(a, b);
 }
Ejemplo n.º 5
0
 public char cchar(char a, char b) {
   return delegate.cchar(a, b);
 }
Ejemplo n.º 6
0
 public double ddouble(double a, double b) {
   return delegate.ddouble(a, b);
 }
Ejemplo n.º 7
0
 public float ffloat(float a, float b, float c, float d) {
   return delegate.ffloat(a, b, c, d);
 }
Ejemplo n.º 8
0
 public byte bbyte(byte a, byte b, byte c) {
   return delegate.bbyte(a, b, c);
 }
Ejemplo n.º 9
0
 public long llong(long a, long b) {
   return delegate.llong(a, b);
 }
Ejemplo n.º 10
0
 public int iint(int a, int b) {
   return delegate.iint(a, b);
 }
Ejemplo n.º 11
0
 public String[] objectsArray(String[] one, String[] two) throws IOException {
   return delegate.objectsArray(one, two);
 }
Ejemplo n.º 12
0
 public String objects(String one, String two) throws IOException {
   return delegate.objects(one, two);
 }