Register FAQ Calendar Search Today's Posts Mark Forums Read

Go Back   Java Programming Forums > Java Programming > New to Java

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 26-08-2008, 06:12 AM
Junior Member
 
Join Date: Aug 2008
Posts: 7
AnithaBabu1 is on a distinguished road
Default [SOLVED] Arrays

Hi all,
I have to w.a.p to display name,age and designation using an array.I am bit confused with arrays any have i tried and written a code,but its showing an error.
Java Code:
class Array
{ 
public static void main(String args[]) 
{
int S[]={{dfg,20,manager},{fgh,36,Asst.Manager},{fgh,36,Marketing Manager}};
for(int i=0;i<3;i++)
System.out.println(s[i]);
}
}
This is the code i have written,will u plz rectify the mistakes.
Thank u.
Reply With Quote
  #2 (permalink)  
Old 07-10-2008, 03:10 PM
Junior Member
 
Join Date: Oct 2008
Posts: 1
d3mian is on a distinguished road
Default Re: Arrays

Still far, far away from practical

Java Code:
String[] s = new String[3];

s[0] = "dfg, 20, manager";
s[1] = "fgh, 36, AsstManager";
s[2] = "fgh, 36, Marketing Manager";

for(int i=0;i<3;i++)
{
    System.out.println(s[i]);
}
I'm just starting out Java myself so be kind :p
Reply With Quote
  #3 (permalink)  
Old 07-10-2008, 07:12 PM
JavaPF's Avatar
Java Programmer
 
Join Date: May 2008
Location: Deep inside the Eclipse IDE
Posts: 172
JavaPF will become famous soon enoughJavaPF will become famous soon enough
Default Re: Arrays

Hello AnithaBabu1.

There is actually quite a few things wrong with your code. For starters, you are trying to hold String values in an Int variable.
Your for loop looks fine so its just Arrays you need to look at.

d3mian has posted a good example. This will work perfectly. As you see the array type is a String variable and this is the easiest way to code it.

Welcome to the Java Programming Forums d3mian!
Reply With Quote
  #4 (permalink)  
Old 04-11-2008, 09:06 AM
Junior Member
 
Join Date: Aug 2008
Posts: 7
AnithaBabu1 is on a distinguished road
Default Re: Arrays

Thank u so much,it works!!!
Reply With Quote
  #5 (permalink)  
Old 04-11-2008, 12:50 PM
JavaPF's Avatar
Java Programmer
 
Join Date: May 2008
Location: Deep inside the Eclipse IDE
Posts: 172
JavaPF will become famous soon enoughJavaPF will become famous soon enough
Default Re: Arrays

Quote:
Originally Posted by AnithaBabu1 View Post
Thank u so much,it works!!!
I'm glad you found your answer here AnithaBabu1.

For a more information check the official Sun Java Tutorials:

Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)
Reply With Quote
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

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


Custom Search
100 most searched terms
Search Cloud
"bad endpoint type" com.sun.xml.internal.messaging.saaj.soapexceptionimpl com.sun.xml.internal.messaging.saaj.soapexceptionimpl: bad endpoint type com.sun.xml.internal.messaging.saaj.soapexceptionimpl: java.security.privilegedactionexception com.sun.xml.internal.messaging.saaj.soapexceptionimpl: java.security.privilegedactionexception: com.sun.xml.internal.messaging.saaj.soapexceptionimpl: java.security.privilegedactionexception: com.sun.xml.internal.messaging.saaj.soapexceptionimpl: message send failed com.sun.xml.internal.messaging.saaj.soapexceptionimpl: message send failed com.sun.xml.messaging.saaj.soapexceptionimpl: java.security.privilegedactionexception com.sun.xml.messaging.saaj.soapexceptionimpl: java.security.privilegedactionexception: com.sun.xml.messaging.saaj.soapexceptionimpl: message send failed convert arraylist to map date_format_now eclipse shortcut keys ejb3 quartz java convert double to binary java forum java forums java jtextarea bold java jtextarea color java jtextarea font java jtextarea font size java programmer forum java programmers forum java programming forum java programming forums java read last line java read last line of file java sendkeys java.security.privilegedactionexception java.security.privilegedactionexception: com.sun.xml.internal.messaging.saaj.soapexceptionimpl java.security.privilegedactionexception: com.sun.xml.internal.messaging.saaj.soapexceptionimpl: bad response java.security.privilegedactionexception: com.sun.xml.internal.messaging.saaj.soapexceptionimpl: message send failed java.security.privilegedactionexception: com.sun.xml.messaging.saaj.soapexceptionimpl: message send failed javapf javaprogrammingforums jtextarea bold jtextarea font jtextarea font color jtextarea font size programing forums programming forums reset jcombobox saaj0008 saaj0008: bad response; bad request saaj0008: bad response; not found severe: saaj0008 severe: saaj0008: bad response; bad request severe: saaj0008: bad response; not found soap java.security.privilegedactionexception soapexceptionimpl: bad endpoint type textpad java

All times are GMT. The time now is 09:57 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.