Beginner Help

+1 Alioune Yague · November 30, 2015
Can anyone help me with this java project? It says to create a class called Tester that one method main and two for-loops. The first for-loop will produce an integer count from 65 to 90 and initialize the elements of the character array ch[] with the characters corresponding to the ASCII codes being generated by the loop. This will fill the ch[] array as follows: ch[0] = 'A', ch[1] = 'B', ..., ch[25] = 'Z'. 

The second loop will print the 26 elements of the ch[] array with one comma followed by one space between adjacent characters. 

Please provide the code for this project and extremely detailed explanation as to why you did what you did. Thank you!

Post a Reply


Oldest  Newest  Rating
0 Kaito Kaito · December 2, 2015
Check this out, but you have to understand it NOT just copying it.

public class Tester {

    public static void main(String[] args) {
        // Creating an array of type Char to store the characters
        char[] character = new char[26];
        // Unicode for A -> starts from 65
        int start = 65;
        // Loop for assigning the characters to the array
        for (int i = 0; i < character.length; i++) {
            character[i] = (char) start;
            // Increment the vairable so we can go to the next letter
        // Loop for displaying the characters
        for (int i = 0; i < character.length; i++) {
            // If statements to remove the last comma
            if(i != (character.length-1)){
                System.out.print(character[i] + ", ");
        // Printing a line after the loop

0 Alioune Yague · December 2, 2015
Thank you. And Garry Whitney, this project is not homework anymore. It is past homework that I did wrong and thought I should understand before going forward because we are doing more with arrays and I'm having trouble understanding the details of why everything works. But thanks though, You're help is greatly appreciated.
0 Gary Whitney · December 1, 2015
Asking someone to do your homework will rarely get you a finished program. It defeats the purpose of homework.
Here is some more help.
1. the ASCII table defines an association between symbols and numbers.
The uppercase letters start at 65. see for more information.
2. Loops in general require 3 things:
 * an initialized variable
 * a Boolean test condition i.e. true or false
 * a statement that changes the variable that was initialized.
3. for loops contain all 3 within the () e.g for (ndx = 65; ndx <91; ndx++)
4. Use the java api to get help e.g.

That should help you do your homework.
0 newbie596 rocky · November 30, 2015
Consider it your reference point.

public class Tester {

public static void main(String[] args) {
//initialize the char array
char [] ch = new char[26];

//The first loop to get each character value
//the first index of char array
int j = 0;
for(int i=65;i
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator