Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » StdOut not recognized
StdOut not recognized [message #1417953] Sat, 06 September 2014 08:37 Go to next message
Neal Koss is currently offline Neal KossFriend
Messages: 13
Registered: November 2010
Junior Member
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...
Re: StdOut not recognized [message #1418045 is a reply to message #1417953] Sat, 06 September 2014 12:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30551
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...
Re: StdOut not recognized [message #1418177 is a reply to message #1418045] Sat, 06 September 2014 17:19 Go to previous message
Neal Koss is currently offline Neal KossFriend
Messages: 13
Registered: November 2010
Junior Member
Thank you....That helped...
Previous Topic:This Is the Only Thing I Need!
Next Topic:Re: implicit typecasting
Goto Forum:
  


Current Time: Sat Oct 19 14:20:18 GMT 2019

Powered by FUDForum. Page generated in 0.04270 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top