I'm trying to compile the following code:
package week1;
public class ThreeSum {
public static int count(int[] a) {
// count triples that sum to 0
int count = 0;
for (int i = 0; i<a.length; i++) {
for (int j = i+1; j < a.length; j++) {
for (int k = j+1; k < a.length; k++) {
if (a[i] + a[j] + a[k] == 0) {
count++;
}
}
}
}
return count;
}
public static void main(String[] args) {
int[] a = In.readInts(args[0]);
StdOut.println(count(a));
}
}
This code is in the ThreeSum.java file in week1 folder. Both classes "In" and "StdOut" are in the package stdlib.jar which is in the ./lib
folder.
I've always used an IDE and now decided to use a command line. So on my
javac -cp .:lib/stdlib.jar week1/ThreeSum.java
and other variants of classpath parameters it returns an error:
week1\ThreeSum.java:20: error: cannot find symbol
int[] a = In.readInts(args[0]);
^
symbol: variable In
location: class ThreeSum
week1\ThreeSum.java:21: error: cannot find symbol
StdOut.println(count(a));
^
symbol: variable StdOut
location: class ThreeSum
How a proper -cp option should look like in my case?