Java Array Question

Okay, I have added comments to explain what i am doing inside the program. I cannot figure out the last one in which i have to display the array backwards. If you can provide any insight as into what i am overlooking it would be of great help. Also if you could suggest a way to format the code so that when executed the stuff is not so close together, it would be greatly appreciated as well.

[400 byte] By [Mediocrerevolutiona] at [2007-11-27 2:25:42]
# 1

sorry forgot to post the code

import java.util.Scanner;

public class AlphaArray {

public static void main(String[] args){

Scanner scanner = new Scanner(System.in);

char[] alphabet = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};

//display Array

System.out.println("The Array is= ");

System.out.println(alphabet);

//display first ten

System.out.println("The first ten are= ");

double firstTen = 0;

for (int i=0; i <10;i++){

System.out.print(alphabet[i]+"");

}

//display last 6

System.out.println("\nThe last six are= ");

double lastSix = 20;

for (int i=0; i<26;i++){

System.out.print(alphabet[i]+"");

}

//diplay 9th

System.out.println("\nThe ninth index is= ");

System.out.println(alphabet[9]);

//display revers index

System.out.println("\nThe reverse order is= ");

double reverse= 26;

for (int i=26; i>0;i--){

System.out.print(alphabet[i]+"");

}

}

}

Mediocrerevolutiona at 2007-7-12 2:34:21 > top of Java-index,Java Essentials,Java Programming...
# 2
What's wrong with your decrement for loop ?Why do you declare 3 doubles but never use ?
rym82a at 2007-7-12 2:34:21 > top of Java-index,Java Essentials,Java Programming...
# 3
try thisfor (int i=25; i>=0;i--){System.out.print(alphabet[i]+"");}
ayberka at 2007-7-12 2:34:21 > top of Java-index,Java Essentials,Java Programming...
# 4
thanx guys! solved my problem
Mediocrerevolutiona at 2007-7-12 2:34:21 > top of Java-index,Java Essentials,Java Programming...
# 5

> try this

>

> > for (int i=25; i>=0;i--)

> {

> System.out.print(alphabet[i]+"");

> }

>

How can I missed that :(

But it would be better to use alphabet.length -1 instead of 25

And for the 2nd method, it should print out last six elements but not all

rym82a at 2007-7-12 2:34:21 > top of Java-index,Java Essentials,Java Programming...
# 6
try to use alphabet.length for the array size and one more thing in java the array subscript starts from 0.
jawadhashmia at 2007-7-12 2:34:21 > top of Java-index,Java Essentials,Java Programming...