
Reverse an array of strings
By: a guest on
Aug 10th, 2012 | syntax:
Java | size: 0.33 KB | hits: 8 | expires: Never
public class Reverse {
public static void main(String[] args) {
String[] list = new String[] {"One", "Two", "Three", "Four", "Five"};
int N = list.length;
for (int i = 0; i < N/2; i++)
{
String temp = list[i];
list[i] = list[N-1-i];
list[N-i-1] = temp;
System.out.println(list[i]);
}
}
}