[...] 
import java.util.Stack;

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

    String mystring = 
      
      "Mary had a little lamb. Its fleece was white as snow. Indiana won last night.";

[...] 

This would run like this for me. 

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop\jq4
> run E158
Lamb little a had mary. Snow as white was fleece its. Night last won indiana.> 

So this is the second problem on the assignment. 

public class Element {
  private int data; 
  private Element next; 
  Element(int data, Element next) {
    this.data = data;  
    this.next = next; 
  }
  public int getData() {
    return this.data;  
  }
  public String toString() {
    return this.data + " " + this.next;  
  }
}

public class Example {
  public static void main(String[] args) {
    Element head; 
    head = new Element( 3, 
                       new Element( 10, 
                                   new Element( 2, 
                                               new Element( 1, 
                                                           null))));
    System.out.println( head ); 
  }
}

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop\jq4
> run Example
3 10 2 1 null


Simple change: 

  public String toString() {
    // return this.data + " " + this.next;  
    if (this.next == null) 
      return this.data + ""; 
    else 
      return this.data + " " + this.next;
  }

Next: 

public class Example {
  public static void main(String[] args) {
    Element head; 
    Element fourth = new Element( 1, null); 
    Element third  = new Element( 2, fourth); 
    Element second = new Element(10, third); 
    Element first  = new Element( 3, second); 
    head = first;
    System.out.println( head ); // 3 10 2 1
    System.out.println( head.first() ); // 3
    System.out.println( head.rest().first() ); // 10 
    System.out.println( head.rest().rest() ); // 2 1 
    System.out.println( head.rest().rest().first() ); // 2 

  }
}

public class Element {
  private int data; 
  private Element next; 
  Element(int data, Element next) {
    this.data = data;  
    this.next = next; 
  }
  public int first() {
    return this.data;  
  }
  public Element rest() { 
    return this.next;  
  }
  public String toString() {
    // return this.data + " " + this.next;  
    if (this.next == null) 
      return this.data + ""; 
    else 
      return this.data + " " + this.next;
  }
}

Next I compile ManyString, Cell and Program. 

--