<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Infinite Loop Problem' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Infinite Loop Problem' posted on the 'Java' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2012 Programmers Heaven</copyright>
    <pubDate>Wed, 23 May 2012 21:17:39 -0700</pubDate>
    <lastBuildDate>Wed, 23 May 2012 21:17:39 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Infinite Loop Problem</title>
      <link>http://www.programmersheaven.com/mb/java/408783/408783/infinite-loop-problem/</link>
      <description>I can't think of how to stop this infinite loop I have ran into. The assignment is to create a menu driven program and have the user enter a word into the dictionary. Then they have the choice to enter more words or check a word against the "dictionary" they have created.&lt;br /&gt;
&lt;br /&gt;
import java.util.Scanner;&lt;br /&gt;
&lt;br /&gt;
public class W11E1 {&lt;br /&gt;
	&lt;br /&gt;
	public static void main(String[] args) {&lt;br /&gt;
		&lt;br /&gt;
		Menu();&lt;br /&gt;
		&lt;br /&gt;
		Scanner input = new Scanner (System.in);&lt;br /&gt;
		&lt;br /&gt;
		String [] array = new String [100];&lt;br /&gt;
		&lt;br /&gt;
		int choice = getChoice();&lt;br /&gt;
		&lt;br /&gt;
		while (true){&lt;br /&gt;
			&lt;br /&gt;
			if (choice == 1){&lt;br /&gt;
				&lt;br /&gt;
				System.out.println("Enter a word into dictionary.");&lt;br /&gt;
				&lt;br /&gt;
				for (int i = 0; i &amp;lt; array.length; i++){&lt;br /&gt;
					array [i] = input.next();&lt;br /&gt;
					&lt;br /&gt;
					if (i &amp;gt; array.length)&lt;br /&gt;
						System.out.println("Limit reached.");}}&lt;br /&gt;
			&lt;br /&gt;
			if (choice == 2){&lt;br /&gt;
				&lt;br /&gt;
				System.out.println("Enter word to check against dictionary.");&lt;br /&gt;
				&lt;br /&gt;
				String Word = CheckWord();&lt;br /&gt;
				&lt;br /&gt;
				for (int i = 0; i &amp;lt; array.length; i++){&lt;br /&gt;
					array [i] = Word;}}&lt;br /&gt;
			&lt;br /&gt;
			if (choice == 3){&lt;br /&gt;
				System.exit(0);}&lt;br /&gt;
			&lt;br /&gt;
			Menu();&lt;br /&gt;
			getChoice();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static void Menu(){&lt;br /&gt;
		System.out.println("Enter your choices corresponding number.");&lt;br /&gt;
		System.out.println("1. Enter a dictionary word.");&lt;br /&gt;
		System.out.println("2. Check a word against the dictionary.");&lt;br /&gt;
		System.out.println("3. Quit.");&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static int getChoice(){&lt;br /&gt;
		Scanner input = new Scanner (System.in);&lt;br /&gt;
		&lt;br /&gt;
		int choice = input.nextInt();&lt;br /&gt;
		&lt;br /&gt;
		return choice;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static String CheckWord(){&lt;br /&gt;
		Scanner input = new Scanner (System.in);&lt;br /&gt;
		&lt;br /&gt;
		String Word = input.next();&lt;br /&gt;
		&lt;br /&gt;
		return Word;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br&gt;&lt;br&gt;&lt;strong&gt;Attachment:&lt;/strong&gt; &lt;a href="http://www.programmersheaven.com/mb/DownloadAttachment.aspx?AttachmentID=1293"&gt;W11E1.java&lt;/a&gt; (1371 bytes | downloaded 43 times)</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java/408783/408783/infinite-loop-problem/</guid>
      <pubDate>Tue, 03 Nov 2009 15:33:09 -0700</pubDate>
      <category>Java</category>
    </item>
  </channel>
</rss>
