|
-
Problem with java program
Good Day!!..
Because i cannot see the output of my program and the only thing that i can do is to compile them and see if there is syntax error..i really had hard time to visualize what is happening in my program...Because of that, i send my prog to my friend and see what is the output of my program...She said that the this part of my simple program:
public class EnterNumbers
{
public static void main(String[] args) throws Exception
{
int [] n = new int [10];
int x = 0;
System.out.println("Enter 0 when you are finish entering numbers!");
do
{
System.out.println ("Please enter number from (1-9): ");
n[x] = (int) System.in.read();
if (x < 10)
{
x = x+1;
}
else
{
System.out.println("You can only enter up to 10 numbers!");
}
}while (n[x] != 0 || n[x] == 10);
System.out.println("The numbers you entered are : ");
for(x=0;x>n.length;x++)
{
System.out.println(n[x] + "\n");
}
System.exit(0);
}
}
***She said that the numbers i am storing in my array is not actually stored so whenever i will print the values of my array.. it doesn't print anything..
Can someone help me or give can give suggestions abou my prog..
*** The prob is: I can input up to 10 numbers using numbers(1-9)only..then it will be stored in an array then print the values of an array..verify if the users enter only numbers (1-9)..
thank you very much...
Similar Threads
-
Replies: 2
Last Post: 06-14-2006, 03:16 PM
-
By dina_raj in forum Java
Replies: 0
Last Post: 12-05-2005, 08:17 AM
-
Replies: 1
Last Post: 05-13-2005, 06:46 AM
-
By Mike Tsakiris in forum .NET
Replies: 11
Last Post: 10-04-2002, 05:32 PM
-
By John Harkin in forum Java
Replies: 1
Last Post: 08-25-2000, 09:34 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks