Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-09-2008, 11:33 AM
Member
 
Join Date: Jan 2008
Posts: 3
yuvi461 is on a distinguished road
To display as a list
import java.io.*;
import java.util.*;

class Arry
{
public static void main (String args[])throws Exception

{

int id[]=new int[5];
String name[]=new String[5];
String dept[]=new String[5];

BufferedReader br =new BufferedReader(new InputStreamReader(System.in));


for(int i=0;i<5;i++)

{

System.out.println("Enter Id");

id[i] = Integer.parseInt(br.readLine());

System.out.println("Enter New name");

name[i]=br.readLine();

System.out.println("Enter Department");

dept[i]=br.readLine();

}

//Arrays.sort(name);

for(int i=0;i<5;i++)

{
System.out.println(id[i]);
System.out.println(name[i]);
System.out.println(dept[i]);
}

}

}

in this program the output will be id,name,dept and goes on until the loop completes.my problem is how could i display it as a table (ie) the corresponding name,id,dept should be printed in the same line.please anybody suggest me a option
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-09-2008, 12:02 PM
Member
 
Join Date: Jul 2007
Posts: 72
Swamipsn is on a distinguished road
for(int i=0;i<5;i++)

{
System.out.print(id[i]);
System.out.print(name[i]);
System.out.print(dept[i]);
}
System.out.print();
}

}

Its make any sense..?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-09-2008, 01:06 PM
Member
 
Join Date: Jan 2008
Posts: 3
yuvi461 is on a distinguished road
actually my problem is i have to make a list and then i have to sort it.so only as a first step i asked in that manner.i m a beginner so forgive me for that cheap question.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display image ? Birkoff AWT / Swing 7 06-09-2008 08:58 AM
GUI components not display Eranga AWT / Swing 2 03-12-2008 03:16 AM
SWT – Display class Java Tip Java Tips 0 12-30-2007 01:19 PM
Adding List to MIDlet Display Java Tip Java Tips 0 11-23-2007 03:07 PM
Display program nhlfan New To Java 2 11-22-2007 01:00 AM


All times are GMT +3. The time now is 10:44 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org