/* * Working with literal arrays and printing them out in a different order. * Integration of charAt( ) for some character handling. */ package arrayrandomscanner2; public class ArrayRandomScanner2 { // global private static variables for all methods in the class // This is one of two different ways to declare an array private static int[] myIntArray = {1,2,3,4,5,6,7,8,9,10,11,12}; private static String[] myStringArray = {"Jan", "Feb","Mar","Apr","May", "Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; public static void main(String[] args) { printInt(); printReverse(); } // end main // ======================================================================= private static void printInt() { // "length" always goes to the end of the array System.out.println("Ascending"); for(int i = 0; i = 0; i-- ){ System.out.println(myIntArray[i] + "\t" + myStringArray[i]); } } } OUTPUT Ascending 1 J 2 F 3 M 4 A 5 M 6 J 7 J 8 A 9 S 10 O 11 N 12 D Descending 12 Dec 11 Nov 10 Oct 9 Sep 8 Aug 7 Jul 6 Jun 5 May 4 Apr 3 Mar 2 Feb 1 Jan BUILD SUCCESSFUL (total time: 1 second)