Mark, Logan, Daniel, Jared, Nathan, Qin, Hallie, Judy, Gabriela, 
 Brennan, Jacquelyn, William, Morgan, Paul, Zac, Jingzhe, Yiming,
 Nick, Grant, Michael, Mohan, Lauren, Adam, Trevor, James, Jack, Thad

 R6.1

 int[] values = { 1, 4, 9, 16, 1, 7, 4, 9, 11 };

 mock exam 

 http://silo.cs.indiana.edu:8346/c212/sum2015/0706c.phps

   Personally while I understand the structure for 
   it, I don't particularly like it. It just seems 
   odd to write out a program by hand. That's just 
   personal preference though, so otherwise I'm fine 
   with it.

Cracking the Coding Interview, 6th Edition: 
189 Programming Questions and Solutions Paperback – July 1, 2015

GAYLE LAAKMANN says: 

Write Code on Paper: Most interviewers won’t give you a computer 
and will instead expect you to write code on a whiteboard or on paper. 
To simulate this environment, try answering interview problems by writing 
code on paper first, and then typing them into a computer as-is. Whiteboard / 
paper coding is a special skill, which can be mastered with constant practice.

See Gayle here: 

https://www.youtube.com/watch?v=aClxtDcdpsQ

https://www.youtube.com/watch?v=rEJzOhC5ZtQ

https://www.youtube.com/watch?v=BN0B4mOtwX0

The class extension mechanism: the ability to model in stages. 

  Inheritance

  Polymorphism 

  Dynamic Method Lookup

  Constructor Chaining

  Shadowing of variables 

class Unicorn extends Horse: 

Horse = { talk }

Unicorn = Horse U { horn, talk }

The class extension mechanism is as simple as the set union of features. 

public class Horse {
  public void talk() {
    System.out.println("Howdy.");  
  }
}

public class Unicorn extends Horse {
  public void sing() {
    System.out.println("That's me in the (uni)corner... R.E.M.");  
  }
  public void talk() {
    super.talk(); 
    System.out.println("Bonjour.");  
  }
}

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> Horse a = new Unicorn(); 
> a.talk()
Howdy.
Bonjour.


Earlier we discussed this program:

class LabNine {
  public static void main(String[] args) {
    Horse a = new Horse(); 
    a.talk(); // prints Howdy
    Horse b = new Horse(); 
    b.talk(); // prints Howdy
    
    Unicorn c = new Unicorn(); // perfectly fine
    c.talk(); // Howdy
    c.sing(); // That's me... 
    
    Horse d = new Unicorn(); // polymorphism
    d.talk(); // Howdy
    ((Unicorn)d).sing(); // That's me in the ... 
    
    // not possible:
    // Unicorn e = new Horse(); 
    
  }
}

The program assumes the second talk method has not yet been defined. 

--