-1

I've copied the following method from page 173 of this book.

public class ThreeSum
{
  public static int count(int[] a)
  { // Count triples that sum to 0.
    int N = a.length;
    int cnt = 0;
    for (int i = 0; i < N; i++)
      for (int j = i+1; j < N; j++)
        for (int k = j+1; k < N; k++)
          if (a[i] + a[j] + a[k] == 0)
            cnt++;
    return cnt;
  }

  public static void main(String[] args)
  {
    int[] a = In.readInts(args[0]); // error here
    StdOut.println(count(a)); // and here
  }
}

The In.readInts causes an error. Do I need to be including a library to access the 'In' object? (third last line)

Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225

1 Answers1

1

Yes, In is not a original Java class, but probably an API/Library class from your book. Look at one of the first pages, probably you will find some information about the class.

Adrian K.
  • 118
  • 1
  • 8