compile error: cannot find symbol: In, StdIn and StdOut

前端 未结 6 1090
隐瞒了意图╮
隐瞒了意图╮ 2020-12-16 13:35

The code is from http://algs4.cs.princeton.edu/11model/BinarySearch.java.html for Algorithms textbook.

import java.         


        
6条回答
  •  臣服心动
    2020-12-16 14:10

    Classes StdIn, StdOut and In aren't part of the standard Java libraries. They're support classes provided to go along with the Princeton course.

    From the 1.1 Programming Model page linked in the source code:

    Standard input and standard output. StdIn.java and StdOut.java are libraries for reading in numbers and text from standard input and printing out numbers and text to standard output. Our versions have a simpler interface than the corresponding Java ones (and provide a few tecnical improvements).

    ...

    In.java and Out.java are object-oriented versions that support multiple input and output streams, including reading from a file or URL and writing to a file.

    So if you want to use the binary search code as-is, you'll need to download those files.

提交回复
热议问题