Giorgi Nakeuri Giorgi Nakeuri - 1 year ago 105
Java Question

In cannot be resolved to a type

I am following Prinston's course

Algorithms, Part I
. As I came from
.NET
and just started to use
Java
, I have some issue with a piece of
Java
code and I can not find any related information. They provide with a code which I can use for reading a text file:

public static void main(String[] args) {

In in = new In(args[0]);
int n = in.readInt();
...
}


Exception thrown:


In cannot be resolved to a type


What is this
In
? Should I import some package or what should I do?

The whole code and description can be also seen here: http://coursera.cs.princeton.edu/algs4/assignments/collinear.html

Answer Source

You need algs4, provided by Princeton as well.

If that's the only class, you could use the source of In.java. But I doubt that's allowed on Coursera: when you submit code, it will probably be compiled on the server with algs4.jar in the classpath, so you should really use that one and not your own code.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download