i want to know arrays please be tell us
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
i want to know arrays please be tell us
Please read the forum rules, and post your question in the appropriate location. Your thread has been moved.
I recommend investing some time using resources at your disposal, rather than asking others to spend their valuable time doing this for you. One resource in particular: google java arrays If you have a more specific question that cannot be addressed after you've invested some time researching, then I encourage you to ask.
Kaluarachchi (June 12th, 2012)
hey i believe an array is kind of like a list of a certain data type. for example
i will make an array of Strings
String list[] = {"one", "Two", "Three"};
here i have created an array call list.
I added three strings to the array "one" " two" and "three".
The [] means its an array of strings i will show you why.
typically there is more than one way to declare arrays so i will show you another way.
String list[] = new String();//this creates the array
list = new String[3]// this tells the compiler how many string are in your array "3"
list[0] = "one";// the first of the array starts at 0
list[1] = "two";//here we declare 3 strings and there index in the array list.
list[2] = "three";//if your not using strings you do not need the "quotation marks"
to use either array you would type
System.out.println(list[0]); // this will print the string at the index 0 aka "one"
System.out.println(list[1]); // this will print the string at the index 1 aka "two"
System.out.println(list[2]); // this will print the string at the index 2 aka "three"
let me know if this helps
Kaluarachchi (June 12th, 2012)
I don't think this will compile. Perhaps you meant
String[] list = new String[3]; // creates a String array of length 3
"String list[] = ..." is also possible, but I think it is clearer when you indicate by String[] the type of thing that is being declared - in this case not a String, but an array of String.
no i compiles alright.
Last edited by .Swing; June 9th, 2012 at 10:12 AM.
Just be nice.
Kaluarachchi (June 12th, 2012)
Please use proper grammar. Saying 'i compiles alright' makes absolutely no sense. This is a programming forum, not a text messaging system. Programmers write code which is extremely syntax dependent - so your sentences should reflect that.
String list[] = new String();
No, this will not compile. You cannot assign an array to a String.
Kaluarachchi (June 12th, 2012)
simple spelling mistake does every moderator have to be so arrogant and well. it compiles for me so I believe it does instead of being so critical you could try help a person in a friendly manner instead of being so aggressive.
I am new to Java and new to this forum. so I am sharing what I have found works for me, I do not mind being corrected in-fact I would not be hear if I was not willing to listen and learn. I would just expect a little more understanding.
I made a mistake I put "i" instead of "is" not big deal but you say it as if I spoke a different language I am
pretty sure although a mistake on my part, it would take you no more than two seconds to realise it is supposed to be is....
thank you
Last edited by .Swing; June 9th, 2012 at 12:22 PM.
Just be nice.
Kaluarachchi (June 12th, 2012)
Its a moderators duty (moderators who do this unpaid and in their spare time) to prevent confusion. Having been doing this for years, I have seen my fair share of confusion lead to people wasting time, questions not getting answered, people getting sidetracked, and worst of all learning incorrectly. Asking someone to write with proper grammar is not arrogance, nor is it critical - it's to prevent confusion. And writing it bluntly is not arrogance or criticism, its a side affect of the impersonal nature of forums such as this. I would like to hope members contributing here do not want their questions or responses to lead to confusion, and would take advice given to them in a respectful and understanding way.
Last edited by copeg; June 9th, 2012 at 12:47 PM.
Kaluarachchi (June 12th, 2012)
I know the duty of a moderator I am just saying there is better ways of spending your time than correcting none code related spelling issues.
As you could tell I was not using text slang It was merely a single missing letter. pointing it out the way you did suggests arrogance.
I do appreciate you time and help, I was just stating your correction of a simple missing letter I the manner you did so was not needed.
from my single day on this forum I have found that moderators such as you seem to talk down to people asking questions, for example.
a new guy joins the forum and asks a questionhe is met with the responsei want to know arrays please be tell us
can you not see how this type of response to a simple question could make this person feel as if this forum is not going to help an simply justPlease read the forum rules, and post your question in the appropriate location. Your thread has been moved.
I recommend investing some time using resources at your disposal, rather than asking others to spend their valuable time doing this for you. One resource in particular: google java arrays If you have a more specific question that cannot be addressed after you've invested some time researching, then I encourage you to ask.
pawn him off to another site or otherwise make him/her go elsewhere.
Just be nice.
Kaluarachchi (June 12th, 2012)
I am not going to itemize my reasons for the format of my response. Suffice it to say my time is valuable to me (and valuable to all the other people here (and elsewhere) asking questions) - so why should I spend my time reproducing what has been said (and said much better than I could say) elsewhere, and can be easily found with a little effort?
If you wish to discuss this further, then please take the discussion to its own topic, PM or conversation rather taking this thread completely off topic. I would rather not have to lock this thread because of it
Kaluarachchi (June 12th, 2012)
thank you for your time I just hope you take a little regard for others feelings when telling people to do it them self, an not to ask for a little help on a forum.
Just be nice.