Answer to Question #41347 in Java | JSP | JSF for solomon

Question #41347
store six of your friend's age in a single array. Assign the ages in a random order. Displaye ages, on reverse order.
1
Expert's answer
2014-05-14T11:28:46-0400
import java.util.Random;
public class Age {

public static void main (String agrc[]) {
Random rand = new Random();
int[] ages = new int[6];

for ( int i = 0; i < 6; i++ ) {
ages[i] = rand.nextInt(80);
System.out.println ( ages[i] );
}
System.out.println ( "Reversed" );
for ( int j = 5 ; j >= 0; j-- ) {
System.out.println ( ages[j] );
}

}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS