|
Re: StdOut not recognized [message #1418045 is a reply to message #1417953] |
Sat, 06 September 2014 12:13 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Neal,
Better to ask about basic Java learning questions on something like
stackoverflow.com:
http://stackoverflow.com/questions/11924757/java-difference-stdout-vs-system-out-println
On 06/09/2014 10:37 AM, Neal Koss wrote:
> I have a "simple" homework problem with the Java file as follows...
>
> public class QuickFindUF {
>
> private int[] id;
>
> public QuickFindUF(int N) {
> id = new int[N];
> for (int i=0; i<N; i++)
> id[i] = i;
> }
>
> public boolean connected(int p, int q) {
> return id[p] == id[q];
> }
>
> public void union(int p, int q) {
> int pid = id[p];
> int qid = id[q];
> for (int i=0; i<id.length; i++)
> if (id[i] == pid) id[i] = qid;
> }
>
> public static void main(String args[]) {
> QuickFindUF z = new QuickFindUF(10);
> z.union(3, 6);
> z.union(6, 0);
> z.union(4, 7);
> z.union(9, 7);
> z.union(4, 8);
> z.union(4, 0);
>
> for (int i=0; i<z.id.length; i++)
> StdOut.print(z.id[i] + " ");
> StdOut.println();
> }
> }
>
>
> StdOut is not recognized. I don't understand why...
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.07917 seconds