SDSU CS535 Object-Oriented Programming & Design
Fall Semester, 1996
Super.Super

[To Lecture Notes Index]
San Diego State University -- This page last updated Oct 15, 1996
----------


Super.Super Slide # 1
References

Java compiler



The best book on programming for the layman is Alice in Wonderland, but that's because it's the best book on anything for the layman
Alan J. Perlis


Super.Super Slide # 2Listen Here!
Super.Super and this.
class GrandParent {
   public String bother = "GrandParent";   
}

class Parent{
   public String bother = "Parent";
}

class  Child  extends Parent {

   public String bother = "Child";
   
   public void bother( String bother ) {
      System.out.println( "bother " + bother );
      System.out.println( "this.bother " + this.bother );
      System.out.println( "super.bother " + super.bother );

      // super.super is a compile error
      //System.out.println( super.super.bother );
   }

   public static void main( String args[] ) {
      Child plays = new Child();
      plays.bother( "Hi" );
   }
}
Output
bother Hi
this.bother Child
super.bother Parent

Super.Super Slide # 3Listen Here!
Style - Layout
class Syntax {

   public static void main( String args[] ) {

      int aVariable = 5;

      if ( aVariable < aFloat )
         System.out.println( "True" ) ;

   }
}

class Syntax 
{
   public static void main( String args[] ) 
   {

      int aVariable = 5;

      if ( aVariable < aFloat )
         System.out.println( "True" ) ;

   }
}

class Syntax 
   {
   public static void main( String args[] ) 
      {

      int aVariable = 5;

      if ( aVariable < aFloat )
         System.out.println( "True" ) ;

      }
   }


----------