![]() |
|
[Java] Need some help on array character sizes - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Java] Need some help on array character sizes (/showthread.php?tid=2258348) |
Need some help on array character sizes - prohax0r - Feb 29, 2012 Hi guys I'm stuck on a question on my java worksheet Quote:5. Write a Java program to do the following: I'm don't know how to go about setting the size of characters and am having trouble understanding the question kind of, can anyone help me out here? WOuld be much appreciated * - SIM-299095 - Feb 29, 2012 As far as I know, arrays must have fixed size, so when you declare a new array you should specify the size of that array, and in this case you must declare an array of the size 26. I think it goes somewhat like this : Code char[] myArray = new char[26];About the second point. Well, I know how to use a loop but I just don't know yet how to make it assign the Alphabet letters one by one as elements of myArray, so I hope someone else in here can help you with that :) Good Luck EDIT : Well, after a little search in Google, I managed to come up with this : Code public static void main(String[] args) {I hope this helps :) * - prohax0r - Feb 29, 2012 Thank you very much ! :) helped alot |