Giorgi Nakeuri Giorgi Nakeuri - 1 year ago 57
Java Question

In cannot be resolved to a type

I am following Prinston's course

Algorithms, Part I
. As I came from
and just started to use
, I have some issue with a piece of
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
? Should I import some package or what should I do?

The whole code and description can be also seen here:

Answer Source

You need algs4, provided by Princeton as well.

If that's the only class, you could use the source of 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.